fix(react-combobox): use role attribute instead of classname for active descendant#36109
Merged
dmytrokirpa merged 1 commit intomasterfrom May 7, 2026
Merged
fix(react-combobox): use role attribute instead of classname for active descendant#36109dmytrokirpa merged 1 commit intomasterfrom
dmytrokirpa merged 1 commit intomasterfrom
Conversation
dmytrokirpa
commented
May 6, 2026
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
mainframev
approved these changes
May 6, 2026
jurokapsiar
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Previous Behavior
The
Optioncomponent’s classname is used in theuseActiveDescendanthook’smatchOptionfunction to figure out if an HTMLElement was rendered by theOptioncomponent. That’s fine for v9, but it doesn’t really work for headless Combobox/Dropdown setups. The main issues are that there aren’t any default classnames on the HTML elements in headless, and if you import classes from the styles hook file, Griffel gets bundled in—even if you’re not using the style hook (not 100% sure, but my theory is thats because Griffel’s AOT creates side effects and style hooks don’t get tree-shaken)New Behavior
Use the HTMLElement's role attribute to check if the element was rendered by the Option component. The role attribute values are based on those defined in the Option component implementation https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-combobox/library/src/components/Option/useOption.tsx#L118-L119
Related Issue(s)