Skip to content

Commit 3abe649

Browse files
authored
chore(components): remove focus workaround as it no longer needed COMPASS-6345 (#6973)
1 parent eccef3f commit 3abe649

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

packages/compass-components/src/components/actions/dropdown-menu-button.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ export function DropdownMenuButton<Action extends string>({
4343
'data-testid': dataTestId,
4444
hideOnNarrow = true,
4545
}: DropdownMenuButtonProps<Action>) {
46-
// this ref is used by the Menu component to calculate the height and position
47-
// of the menu, and by us to give back the focus to the trigger when the menu
48-
// is closed (https://jira.mongodb.org/browse/PD-1674).
46+
// This ref is used by the Menu component to calculate the height and position
47+
// of the menu.
4948
const menuTriggerRef = useRef<HTMLButtonElement | null>(null);
5049
const [isMenuOpen, setIsMenuOpen] = useState(false);
5150

@@ -54,8 +53,6 @@ export function DropdownMenuButton<Action extends string>({
5453
evt.stopPropagation();
5554
if (evt.currentTarget.dataset.menuitem) {
5655
setIsMenuOpen(false);
57-
// Workaround for https://jira.mongodb.org/browse/PD-1674
58-
menuTriggerRef.current?.focus();
5956
}
6057
const actionName = evt.currentTarget.dataset.action;
6158
if (typeof actionName !== 'string') {

packages/compass-components/src/components/actions/item-action-menu.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ export function ItemActionMenu<Action extends string>({
6262
iconSize = ItemActionButtonSize.Default,
6363
'data-testid': dataTestId,
6464
}: ItemActionMenuProps<Action>) {
65-
// this ref is used by the Menu component to calculate the height and position
66-
// of the menu, and by us to give back the focus to the trigger when the menu
67-
// is closed (https://jira.mongodb.org/browse/PD-1674).
65+
// This ref is used by the Menu component to calculate the height and position
66+
// of the menu.
6867
const menuTriggerRef = useRef<HTMLButtonElement | null>(null);
6968
const [isMenuOpen, setIsMenuOpen] = useState(false);
7069

@@ -73,8 +72,6 @@ export function ItemActionMenu<Action extends string>({
7372
evt.stopPropagation();
7473
if (evt.currentTarget.dataset.menuitem) {
7574
setIsMenuOpen(false);
76-
// Workaround for https://jira.mongodb.org/browse/PD-1674
77-
menuTriggerRef.current?.focus();
7875
}
7976
const actionName = evt.currentTarget.dataset.action;
8077
if (typeof actionName !== 'string') {

0 commit comments

Comments
 (0)