Skip to content
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

Make close behavior for Dialogs more granular, configurable #912

Merged
merged 2 commits into from
Mar 10, 2023

Conversation

lyzadanger
Copy link
Contributor

This PR replaces the use of useElementShouldClose with newly-added, more granular hooks. Modal Dialogs still default to close on ESC, but no longer default to close on click-away or focus-away (this more closely echoes the native dialog element behavior). But all three behaviors can be controlled via props.

This is documented on the Dialog pattern-library page, so I'll leave it to the reviewer to determine whether the documentation is clear enough!

Part of #77
Depends on #911

@lyzadanger lyzadanger requested a review from acelaya March 9, 2023 21:45
Base automatically changed from add-event-hooks to main March 10, 2023 14:04
Also: change default such that `closeOnClickAway` is not enabled for
modal dialogs.
@lyzadanger lyzadanger force-pushed the update-close-behavior branch from 6e81b67 to 45f6026 Compare March 10, 2023 14:06
@codecov
Copy link

codecov bot commented Mar 10, 2023

Codecov Report

Merging #912 (45f6026) into main (db2a927) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #912   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           63        63           
  Lines          790       795    +5     
  Branches       284       287    +3     
=========================================
+ Hits           790       795    +5     
Impacted Files Coverage Δ
src/components/feedback/Dialog.tsx 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@lyzadanger lyzadanger merged commit 07207e7 into main Mar 10, 2023
@lyzadanger lyzadanger deleted the update-close-behavior branch March 10, 2023 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants