diff --git a/package.json b/package.json index f44078b42b..8486b9c696 100644 --- a/package.json +++ b/package.json @@ -381,6 +381,7 @@ "webpack": "^4.43.0", "webpack-cli": "^3.3.11", "webpack-node-externals": "^1.7.2", + "what-input": "^5.2.10", "xterm": "^4.6.0", "xterm-addon-fit": "^0.4.0" } diff --git a/src/renderer/components/app.tsx b/src/renderer/components/app.tsx index 5ad908a528..a5ebe554d1 100755 --- a/src/renderer/components/app.tsx +++ b/src/renderer/components/app.tsx @@ -38,7 +38,8 @@ import { webFrame } from "electron"; import { clusterPageRegistry } from "../../extensions/registries/page-registry"; import { DynamicPage } from "../../extensions/dynamic-page"; import { extensionLoader } from "../../extensions/extension-loader"; -import { appEventBus } from "../../common/event-bus" +import { appEventBus } from "../../common/event-bus"; +import whatInput from 'what-input'; @observer export class App extends React.Component { @@ -57,6 +58,7 @@ export class App extends React.Component { window.addEventListener("online", () => { window.location.reload() }) + whatInput.ask() // Start to monitor user input device } get startURL() { diff --git a/src/renderer/components/icon/icon.scss b/src/renderer/components/icon/icon.scss index 5840f53602..e581ccbbdc 100644 --- a/src/renderer/components/icon/icon.scss +++ b/src/renderer/components/icon/icon.scss @@ -119,7 +119,7 @@ &.focusable:focus:not(:hover) { box-shadow: 0 0 0 2px var(--focus-color); - .mouse-intent & { + [data-whatintent='mouse'] & { box-shadow: none; &.active { diff --git a/src/renderer/components/layout/main-layout.tsx b/src/renderer/components/layout/main-layout.tsx index 2c3c718d65..e66fed3d17 100755 --- a/src/renderer/components/layout/main-layout.tsx +++ b/src/renderer/components/layout/main-layout.tsx @@ -38,17 +38,6 @@ export class MainLayout extends React.Component { (sidebarWidth) => this.storage.merge({ sidebarWidth }) ); - componentDidMount() { - // Toggling .mouse-intent class if mouse or keyboard using in the dashboard - // This allows to remove focus styling to elements when mouse is used - window.addEventListener("click", (evt) => { - if (!evt.detail) return; // No mouse used (e.g. hitted spacebar on button) - document.body.classList.add("mouse-intent"); - }) - window.addEventListener("keydown", (evt) => { - document.body.classList.remove("mouse-intent"); - }) - } toggleSidebar = () => { this.isPinned = !this.isPinned; diff --git a/yarn.lock b/yarn.lock index d981af5d90..69e91792c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13760,6 +13760,11 @@ wgxpath@~1.0.0: resolved "https://registry.yarnpkg.com/wgxpath/-/wgxpath-1.0.0.tgz#eef8a4b9d558cc495ad3a9a2b751597ecd9af690" integrity sha1-7vikudVYzEla06mit1FZfs2a9pA= +what-input@^5.2.10: + version "5.2.10" + resolved "https://registry.yarnpkg.com/what-input/-/what-input-5.2.10.tgz#f79f5b65cf95d75e55e6d580bb0a6b98174cad4e" + integrity sha512-7AQoIMGq7uU8esmKniOtZG3A+pzlwgeyFpkS3f/yzRbxknSL68tvn5gjE6bZ4OMFxCPjpaBd2udUTqlZ0HwrXQ== + whatwg-encoding@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0"