Skip to content

fix(react-headless-components-preview): use global focusgroup typing for MenuListState - #36608

Open
Dmytro Kirpa (dmytrokirpa) wants to merge 1 commit into
microsoft:masterfrom
dmytrokirpa:fix/headless-menulist-focusgroup-typing
Open

fix(react-headless-components-preview): use global focusgroup typing for MenuListState#36608
Dmytro Kirpa (dmytrokirpa) wants to merge 1 commit into
microsoft:masterfrom
dmytrokirpa:fix/headless-menulist-focusgroup-typing

Conversation

@dmytrokirpa

Copy link
Copy Markdown
Contributor

Description

MenuListState locally intersected the base state with a hand-rolled focusgroup declaration:

export type MenuListState = MenuListBaseState & {
  root: {
    focusgroup?: string;
  };
};

This existed only to type the attribute assigned in useMenuList. But the repo-wide typings/focusgroup augmentation already adds focusgroup to React's HTMLAttributes, so the local override was:

  • redundant — the property is already available on root
  • weakerstring instead of the constrained FocusgroupAttribute union, so invalid values like focusgroup=\"tree\" wouldn't be caught
  • noisy in the public API — it forced the base type to be re-exported under a MenuListState_2 alias

Now MenuListState is re-exported directly from @fluentui/react-menu, and useMenuList relies on the global typing.

Verification

  • yarn nx run react-headless-components-preview:type-check passes
  • etc/menu.api.md regenerated — the alias and the local intersection are gone
  • Change file added

…for MenuListState

MenuListState locally intersected the base state with '{ root: { focusgroup?: string } }'
to type the attribute set in useMenuList. The repo-wide 'typings/focusgroup' augmentation
already adds a strongly typed 'focusgroup' to React's HTMLAttributes, so the local override
was redundant, weaker (plain string), and forced the base type to be re-exported under an
alias in the public API.

Re-export MenuListState directly from '@fluentui/react-menu'.
@github-actions

Copy link
Copy Markdown

📊 Bundle size report

✅ No changes found

@github-actions

Copy link
Copy Markdown

Pull request demo site: URL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant