Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ export function DropdownMenuButton<Action extends string>({
'data-testid': dataTestId,
hideOnNarrow = true,
}: DropdownMenuButtonProps<Action>) {
// this ref is used by the Menu component to calculate the height and position
// of the menu, and by us to give back the focus to the trigger when the menu
// is closed (https://jira.mongodb.org/browse/PD-1674).
// This ref is used by the Menu component to calculate the height and position
// of the menu.
const menuTriggerRef = useRef<HTMLButtonElement | null>(null);
const [isMenuOpen, setIsMenuOpen] = useState(false);

Expand All @@ -54,8 +53,6 @@ export function DropdownMenuButton<Action extends string>({
evt.stopPropagation();
if (evt.currentTarget.dataset.menuitem) {
setIsMenuOpen(false);
// Workaround for https://jira.mongodb.org/browse/PD-1674
menuTriggerRef.current?.focus();
}
const actionName = evt.currentTarget.dataset.action;
if (typeof actionName !== 'string') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ export function ItemActionMenu<Action extends string>({
iconSize = ItemActionButtonSize.Default,
'data-testid': dataTestId,
}: ItemActionMenuProps<Action>) {
// this ref is used by the Menu component to calculate the height and position
// of the menu, and by us to give back the focus to the trigger when the menu
// is closed (https://jira.mongodb.org/browse/PD-1674).
// This ref is used by the Menu component to calculate the height and position
// of the menu.
const menuTriggerRef = useRef<HTMLButtonElement | null>(null);
const [isMenuOpen, setIsMenuOpen] = useState(false);

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