From 2fa0224d360f5aeb16e667b758485ea89bcaf37c Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sun, 5 Apr 2020 16:34:16 +0200 Subject: [PATCH] Remove keycode, reduce bundle size --- package.json | 1 - src/components/tooltip/WithTooltip.js | 3 +-- yarn.lock | 5 ----- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/package.json b/package.json index 0d411eba..c138b3ea 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ ] }, "dependencies": { - "keycode": "^2.2.0", "polished": "^3.4.1", "prismjs": "1.17.1", "react-modal": "^3.10.1", diff --git a/src/components/tooltip/WithTooltip.js b/src/components/tooltip/WithTooltip.js index aa8c60da..3c564e20 100644 --- a/src/components/tooltip/WithTooltip.js +++ b/src/components/tooltip/WithTooltip.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import styled from 'styled-components'; import TooltipTrigger from 'react-popper-tooltip'; import uuid from 'uuid'; -import keyCode from 'keycode'; import { Tooltip } from './Tooltip'; @@ -54,7 +53,7 @@ const AsComponent = React.forwardRef( if (!onClick) { return; } - if (event.keyCode === keyCode('enter') || event.keyCode === keyCode('space')) { + if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); onClick(event); } diff --git a/yarn.lock b/yarn.lock index 55b6f21f..6a02eea4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9068,11 +9068,6 @@ jsx-ast-utils@^2.2.1: array-includes "^3.0.3" object.assign "^4.1.0" -keycode@^2.2.0: - version "2.2.0" - resolved "https://registry.npmjs.org/keycode/-/keycode-2.2.0.tgz#3d0af56dc7b8b8e5cba8d0a97f107204eec22b04" - integrity sha1-PQr1bce4uOXLqNCpfxByBO7CKwQ= - kind-of@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/kind-of/-/kind-of-2.0.1.tgz#018ec7a4ce7e3a86cb9141be519d24c8faa981b5"