-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Menu should not steal focus on close #27414
Merged
Merged
Conversation
This file contains 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
Changes the focus effect in `useMenu` so that focus is only restored to the menu trigger if the activeElement is the document body. The focus should revert to body automatically when the MenuPopover component is unmounted. If a user has focused another element, then the focus should not revert to the trigger. Also adds a small React 18 fix to `useFirstMount` so that the ref is written in an effect
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 6f17b86:
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 618bccf669722de1519e1408661be1919d6a078d (build) |
📊 Bundle size reportUnchanged fixtures
|
Perf Analysis (
|
Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
---|---|---|---|---|---|
Avatar | mount | 898 | 932 | 5000 | |
Button | mount | 586 | 572 | 5000 | |
Field | mount | 1644 | 1657 | 5000 | |
FluentProvider | mount | 1161 | 1187 | 5000 | |
FluentProviderWithTheme | mount | 308 | 299 | 10 | |
FluentProviderWithTheme | virtual-rerender | 283 | 280 | 10 | |
FluentProviderWithTheme | virtual-rerender-with-unmount | 287 | 309 | 10 | |
InfoButton | mount | 213 | 210 | 5000 | |
MakeStyles | mount | 1352 | 1345 | 50000 | |
Persona | mount | 2310 | 2220 | 5000 | |
SpinButton | mount | 1978 | 2012 | 5000 |
🕵 fluentuiv9 No visual regressions between this PR and main |
layershifter
reviewed
Apr 3, 2023
packages/react-components/react-utilities/src/hooks/useFirstMount.ts
Outdated
Show resolved
Hide resolved
layershifter
approved these changes
Apr 3, 2023
marcosmoura
added a commit
to marcosmoura/fluentui
that referenced
this pull request
Apr 4, 2023
* master: (39 commits) Added merge tests for custom styles (microsoft#27086) fix: make Option's checkIcon slot render conditionally (microsoft#27409) docs: add subcomponents to Combobox and Dropdown docs (microsoft#27410) Breadcrumb spec (microsoft#26742) bugfix(react-utilities): increments SlotRenderFunction signature to include children (microsoft#27377) fix: Menu should not steal focus on close (microsoft#27414) Fixed Overflow component when there's more then one children element (microsoft#27402) feat(scripts-executors): support custom base and printing all affected packages for checkIfPackagesAffected (microsoft#27364) applying package updates feat(scripts-tasks): make perf test setup generic (microsoft#26920) fix: ColorPicker preview color updated to ignore forced colors (microsoft#27394) fix: Fix babel build error on windows (microsoft#27406) chore(react-datepicker-compat): Add vr-tests and bundle-size fixtures for DatePicker (microsoft#27351) fix(react-dialog): DialogContent scrollbar always visible (microsoft#27367) docs: Add tokens search (microsoft#27265) chore(scripts-tasks): remove not needed api-extractor task logs (microsoft#27094) chore(react-tree): adds e2e flat tree tests (microsoft#27318) applying package updates Accessibility fix for empty vertical bar chart (microsoft#26254) fix(react-datepicker-compat): Fix theming issues with all themes and WHCM (microsoft#27361) ...
ling1726
added a commit
to ling1726/fluentui
that referenced
this pull request
Apr 25, 2023
Follow up from microsoft#27414. The focusing effect should not re-run if the value of `firstMount` changes.
ling1726
added a commit
that referenced
this pull request
Apr 25, 2023
* fix: Menu should not steal focus on re-render Follow up from #27414. The focusing effect should not re-run if the value of `firstMount` changes. * changefile
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.
Changes the focus effect in
useMenu
so that focus is only restored to the menu trigger if the activeElement is the document body. The focus should revert to body automatically when the MenuPopover component is unmounted. If a user has focused another element, then the focus should not revert to the trigger.Fixes #27374
Fixes #27373