-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(react-dialog): allows user to opt-out of uncontrolled open changes #29204
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
Conversation
|
Follow up on #28276 (comment) |
|
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 6f318ca:
|
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 601 | 613 | 5000 | |
| Button | mount | 313 | 308 | 5000 | |
| Field | mount | 1122 | 1124 | 5000 | |
| FluentProvider | mount | 708 | 705 | 5000 | |
| FluentProviderWithTheme | mount | 85 | 83 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 65 | 67 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 70 | 84 | 10 | |
| InfoButton | mount | 17 | 8 | 5000 | |
| MakeStyles | mount | 829 | 873 | 50000 | |
| Persona | mount | 1742 | 1686 | 5000 | |
| SpinButton | mount | 1369 | 1343 | 5000 |
🕵 fluentuiv9 No visual regressions between this PR and main |
📊 Bundle size report
Unchanged fixtures
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 81d629fbc7206dab2bc2dd4878487a079601f396 (build) |
Default prevention can't be trusted on all use case scenarios, for example on navigation cases the prevention will be required to stop scrolling, and then there's no way you can tell if the prevention means "don't do nothing" or "do something but don't scroll", This problem is present in #29091
|
|
To summarize:
Is it correct? |
Correct, it works in current scenario but it has never been documented and it's not an official solution. We don't have an official solution for an opt-out mechanism, at the moment if you want to opt-out you have to control the state (in the majority of v9 components). I'll convert this back into a draft, as I believe this mechanism should be better discussed. |
Agree, would like to write RFC with proposed approaches? |


Previous Behavior
At the moment if the user wants to prevent
Escapeto close a dialog, controlling the dialog open state is requiredhttps://codesandbox.io/s/sad-star-c7ytcs?file=/example.tsx
New Behavior
onOpenChangeTo opt-out of
Escapefor example, this is doable: