Skip to content
Open
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
@@ -0,0 +1,7 @@
{

@github-actions github-actions Bot Jun 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Menu Converged - submenuIndicator slotted content 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default - RTL.submenus open.chromium.png 404 Changed
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default.submenus open.chromium.png 413 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 151 Changed
vr-tests-react-components/Positioning.Positioning end.chromium.png 279 Changed
vr-tests-react-components/ProgressBar converged 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - Dark Mode.default.chromium.png 67 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png 115 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png 117 Changed
vr-tests-react-components/TagPicker 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled.disabled input hover.chromium.png 677 Changed

There were 1 duplicate changes discarded. Check the build logs for more information.

"type": "patch",
"comment": "fix: Escape in an open Menu does not trigger tabster actions",
"packageName": "@fluentui/react-menu",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,16 @@ describe('useMenuPopover_unstable', () => {
expect((result.current.root as Record<string, unknown>)['data-testid']).toBe('popover');
});

it('spreads restoreFocusSource attributes onto root', () => {
it('spreads restoreFocusSource and ignoreKeydown attributes onto root', () => {
const { wrapper } = makeWrapper();

const { result } = renderHook(() => useMenuPopover_unstable({}, null), { wrapper });

expect((result.current.root as Record<string, unknown>)['data-tabster']).toBe('{"restorer":{"type":1}}');
// tabster is told to ignore Escape so the menu (which closes itself on Escape)
// doesn't also escape a parent groupper/modalizer
expect((result.current.root as Record<string, unknown>)['data-tabster']).toBe(
'{"restorer":{"type":1},"focusable":{"ignoreKeydown":{"Escape":true}}}',
);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import { ArrowLeft, Tab, ArrowRight, Escape } from '@fluentui/keyboard-keys';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import { useMotionForwardedRef } from '@fluentui/react-motion';
import { useRestoreFocusSource } from '@fluentui/react-tabster';
import {
useRestoreFocusSource,
useTabsterAttributes,
useMergedTabsterAttributes_unstable,
} from '@fluentui/react-tabster';
import { getIntrinsicElementProps, useEventCallback, useMergedRefs, slot, useTimeout } from '@fluentui/react-utilities';
import * as React from 'react';

Expand Down Expand Up @@ -129,13 +133,23 @@ export const useMenuPopoverBase_unstable = (props: MenuPopoverProps, ref: React.
*/
export const useMenuPopover_unstable = (props: MenuPopoverProps, ref: React.Ref<HTMLElement>): MenuPopoverState => {
const restoreFocusSourceAttributes = useRestoreFocusSource();

// Opt the menu's popover out of tabster's Escape handling. The menu closes itself on
// Escape; without this tabster would also act on Escape (e.g. escaping a parent
// groupper/modalizer) and move focus away from the trigger instead of restoring it.
const ignoreEscapeKeyAttribute = useTabsterAttributes({
focusable: { ignoreKeydown: { Escape: true } },
});

const tabsterAttributes = useMergedTabsterAttributes_unstable(restoreFocusSourceAttributes, ignoreEscapeKeyAttribute);

const motionRef = useMotionForwardedRef();
const baseState = useMenuPopoverBase_unstable(props, ref);

return {
...baseState,
root: {
...restoreFocusSourceAttributes,
...tabsterAttributes,
...baseState.root,
ref: useMergedRefs(baseState.root.ref, motionRef) as React.Ref<HTMLDivElement>,
},
Expand Down
Loading