From a5b552ecb64166735a1d74ae9ce5de1e47700c81 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 10 Oct 2023 23:14:00 +0800 Subject: [PATCH 1/4] remove unused code --- src/libs/DomUtils/index.native.ts | 5 +---- src/libs/DomUtils/index.ts | 13 +------------ src/libs/DomUtils/types.ts | 3 +-- src/libs/Navigation/Navigation.js | 5 ----- 4 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/libs/DomUtils/index.native.ts b/src/libs/DomUtils/index.native.ts index d3774baec208..1c52e5076cd4 100644 --- a/src/libs/DomUtils/index.native.ts +++ b/src/libs/DomUtils/index.native.ts @@ -1,10 +1,7 @@ -import {BlurActiveElement, GetActiveElement} from './types'; - -const blurActiveElement: BlurActiveElement = () => {}; +import {GetActiveElement} from './types'; const getActiveElement: GetActiveElement = () => null; export default { - blurActiveElement, getActiveElement, }; diff --git a/src/libs/DomUtils/index.ts b/src/libs/DomUtils/index.ts index 784a01bd7885..1aa0dab8b6ab 100644 --- a/src/libs/DomUtils/index.ts +++ b/src/libs/DomUtils/index.ts @@ -1,18 +1,7 @@ -import {BlurActiveElement, GetActiveElement} from './types'; - -const blurActiveElement: BlurActiveElement = () => { - const activeElement = document.activeElement as HTMLElement; - - if (!activeElement?.blur) { - return; - } - - activeElement.blur(); -}; +import {GetActiveElement} from './types'; const getActiveElement: GetActiveElement = () => document.activeElement; export default { - blurActiveElement, getActiveElement, }; diff --git a/src/libs/DomUtils/types.ts b/src/libs/DomUtils/types.ts index 8be7b3cddae5..9a9fa0729f71 100644 --- a/src/libs/DomUtils/types.ts +++ b/src/libs/DomUtils/types.ts @@ -1,4 +1,3 @@ -type BlurActiveElement = () => void; type GetActiveElement = () => Element | null; -export type {BlurActiveElement, GetActiveElement}; +export type {GetActiveElement}; diff --git a/src/libs/Navigation/Navigation.js b/src/libs/Navigation/Navigation.js index 3e3dc59dcd80..6f67210a4d80 100644 --- a/src/libs/Navigation/Navigation.js +++ b/src/libs/Navigation/Navigation.js @@ -92,11 +92,6 @@ function navigate(route = ROUTES.HOME, type) { return; } - // A pressed navigation button will remain focused, keeping its tooltip visible, even if it's supposed to be out of view. - // To prevent that we blur the button manually (especially for Safari, where the mouse leave event is missing). - // More info: https://github.com/Expensify/App/issues/13146 - DomUtils.blurActiveElement(); - linkTo(navigationRef.current, route, type); } From 8d09bd7bf547d86fb4f78b83eb7dc098caa5504e Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 10 Oct 2023 23:15:49 +0800 Subject: [PATCH 2/4] remove unused code --- src/libs/Navigation/AppNavigator/AuthScreens.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index 428550a43aa8..7be9a7fc838b 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -185,12 +185,7 @@ class AuthScreens extends React.Component { this.unsubscribeSearchShortcut = KeyboardShortcut.subscribe( searchShortcutConfig.shortcutKey, () => { - Modal.close(() => { - if (Navigation.isActiveRoute(ROUTES.SEARCH)) { - return; - } - return Navigation.navigate(ROUTES.SEARCH); - }); + Modal.close(() => Navigation.navigate(ROUTES.SEARCH)); }, searchShortcutConfig.descriptionKey, searchShortcutConfig.modifiers, @@ -199,12 +194,7 @@ class AuthScreens extends React.Component { this.unsubscribeChatShortcut = KeyboardShortcut.subscribe( chatShortcutConfig.shortcutKey, () => { - Modal.close(() => { - if (Navigation.isActiveRoute(ROUTES.NEW)) { - return; - } - Navigation.navigate(ROUTES.NEW); - }); + Modal.close(() => Navigation.navigate(ROUTES.NEW)); }, chatShortcutConfig.descriptionKey, chatShortcutConfig.modifiers, From 33b478db49c33c5dc0b092ea0232ef17dcd0ac8d Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 11 Oct 2023 12:44:29 +0800 Subject: [PATCH 3/4] removed unused import --- src/libs/Navigation/Navigation.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/Navigation/Navigation.js b/src/libs/Navigation/Navigation.js index 6f67210a4d80..912e7b23b3dc 100644 --- a/src/libs/Navigation/Navigation.js +++ b/src/libs/Navigation/Navigation.js @@ -3,7 +3,6 @@ import lodashGet from 'lodash/get'; import {CommonActions, getPathFromState, StackActions} from '@react-navigation/native'; import {getActionFromState} from '@react-navigation/core'; import Log from '../Log'; -import DomUtils from '../DomUtils'; import linkTo from './linkTo'; import ROUTES from '../../ROUTES'; import linkingConfig from './linkingConfig'; From 6a69786cb4b68b0b0d2c0108c793689586e62d1e Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 11 Oct 2023 12:52:05 +0800 Subject: [PATCH 4/4] export default type --- src/libs/DomUtils/index.native.ts | 2 +- src/libs/DomUtils/index.ts | 2 +- src/libs/DomUtils/types.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/DomUtils/index.native.ts b/src/libs/DomUtils/index.native.ts index 1c52e5076cd4..9a9758228776 100644 --- a/src/libs/DomUtils/index.native.ts +++ b/src/libs/DomUtils/index.native.ts @@ -1,4 +1,4 @@ -import {GetActiveElement} from './types'; +import GetActiveElement from './types'; const getActiveElement: GetActiveElement = () => null; diff --git a/src/libs/DomUtils/index.ts b/src/libs/DomUtils/index.ts index 1aa0dab8b6ab..94dd54547454 100644 --- a/src/libs/DomUtils/index.ts +++ b/src/libs/DomUtils/index.ts @@ -1,4 +1,4 @@ -import {GetActiveElement} from './types'; +import GetActiveElement from './types'; const getActiveElement: GetActiveElement = () => document.activeElement; diff --git a/src/libs/DomUtils/types.ts b/src/libs/DomUtils/types.ts index 9a9fa0729f71..fe121bc07f3c 100644 --- a/src/libs/DomUtils/types.ts +++ b/src/libs/DomUtils/types.ts @@ -1,3 +1,3 @@ type GetActiveElement = () => Element | null; -export type {GetActiveElement}; +export default GetActiveElement;