Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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,6 @@
{
"type": "patch",
"comment": "fix(react-headless-components-preview): exclude unsupported styled Menu composition props",
"packageName": "@fluentui/react-headless-components-preview",
"email": "paulmardling@microsoft.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
Comment thread
PaulGMardling marked this conversation as resolved.
"type": "minor",
"comment": "feat(react-menu): add opt-in autofocus suppression and external trigger registration",
"packageName": "@fluentui/react-menu",
"email": "paulmardling@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export { MenuPopoverSlots }
export { MenuPopoverState }

// @public (undocumented)
export type MenuProps = Omit<MenuBaseProps, 'positioning'> & {
export type MenuProps = Omit<MenuBaseProps, 'positioning' | 'unstable_disableAutoFocus' | 'unstable_triggerElement'> & {
positioning?: PositioningShorthand;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@ import { MenuGroupHeader } from './MenuGroupHeader/MenuGroupHeader';
import { MenuSplitGroup } from './MenuSplitGroup/MenuSplitGroup';

describe('Menu', () => {
it('compile-time: does not accept unsupported autofocus suppression', () => {
const element = (
// @ts-expect-error The headless Menu has its own autofocus implementation.
<Menu unstable_disableAutoFocus>
<MenuPopover />
</Menu>
);
expect(element).toBeDefined();
});

it('compile-time: does not accept unsupported external trigger registration', () => {
const element = (
// @ts-expect-error The headless Menu does not register external triggers.
<Menu unstable_triggerElement={null}>
<MenuPopover />
</Menu>
);
expect(element).toBeDefined();
});

it('renders trigger and surface children when open', () => {
const { getByText } = render(
<Menu defaultOpen>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MenuBaseProps } from '@fluentui/react-menu';
import type { PositioningShorthand } from '../../positioning';

export type MenuProps = Omit<MenuBaseProps, 'positioning'> & {
export type MenuProps = Omit<MenuBaseProps, 'positioning' | 'unstable_disableAutoFocus' | 'unstable_triggerElement'> & {
/**
* Configures the positioned menu.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ export type MenuPopoverState = ComponentState<MenuPopoverSlots> & Pick<PortalPro

// @public
export type MenuProps = ComponentProps<Partial<MenuSlots>> & Pick<PortalProps, 'mountNode'> & Pick<MenuListProps, 'checkedValues' | 'defaultCheckedValues' | 'hasCheckmarks' | 'hasIcons' | 'onCheckedValueChange'> & {
unstable_disableAutoFocus?: boolean;
unstable_triggerElement?: HTMLElement | null;
children: [JSXElement, JSXElement] | JSXElement;
hoverDelay?: number;
inline?: boolean;
Expand Down
Loading
Loading