Skip to content

Commit 62000d8

Browse files
authored
Merge pull request #39402 from software-mansion-labs/bug/workspace-switcher
Workspace switcher - Workspace switcher reopens after selecting a workspace with keyboard
2 parents b26ce3b + b5a09b7 commit 62000d8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/components/WorkspaceSwitcherButton.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {useMemo} from 'react';
1+
import React, {useMemo, useRef} from 'react';
2+
import type {View} from 'react-native';
23
import type {OnyxEntry} from 'react-native-onyx';
34
import useLocalize from '@hooks/useLocalize';
45
import useTheme from '@hooks/useTheme';
@@ -23,6 +24,8 @@ function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) {
2324
const {translate} = useLocalize();
2425
const theme = useTheme();
2526

27+
const pressableRef = useRef<HTMLDivElement | View | null>(null);
28+
2629
const {source, name, type} = useMemo(() => {
2730
if (!policy) {
2831
return {source: Expensicons.ExpensifyAppIcon, name: CONST.WORKSPACE_SWITCHER.NAME, type: CONST.ICON_TYPE_AVATAR};
@@ -39,14 +42,16 @@ function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) {
3942
return (
4043
<Tooltip text={translate('workspace.switcher.headerTitle')}>
4144
<PressableWithFeedback
45+
ref={pressableRef}
4246
accessibilityRole={CONST.ROLE.BUTTON}
4347
accessibilityLabel={translate('common.workspaces')}
4448
accessible
45-
onPress={() =>
49+
onPress={() => {
50+
pressableRef?.current?.blur();
4651
interceptAnonymousUser(() => {
4752
Navigation.navigate(ROUTES.WORKSPACE_SWITCHER);
48-
})
49-
}
53+
});
54+
}}
5055
>
5156
{({hovered}) => (
5257
<SubscriptAvatar

0 commit comments

Comments
 (0)