-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add isBusy prop to ConfirmDialog #73041
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
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
ntsekouras
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I've left a couple of comments regarding the storybook and tests, but the actual code changes in the component look good.
|
Thanks for reviewing, Nik! I'll wait to see if we keep the tests or not. |
aduth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an intended use-case for this somewhere in Gutenberg? I'm trying to make sure I understand the need here.
On one hand, I think ConfirmDialog is a high-level component that should surface common customizations of these kinds of modals; on the other, someone still has the option to compose their own Modal in the same way as ConfirmDialog does, and apply these properties to buttons directly. It reminds me of some of the problems raised in #71196, where this is a good example of Modal not always being so easy to customize while ensuring consistency. I think this change could be okay, but maybe in the future we'll want to revisit the Modal abstractions to make it easier to configure buttons in a way that balances developer experience and visual consistency.
As far as the tests are concerned, I think it could be reasonable to have a test, but I'd suggest limiting it to 1 perhaps? For the sake of maintainability and test performance. Optionally rerendering multiple times with different combinations, or moving the "not set busy" assertions into the default rendering test case.
|
Thanks for taking a look and for the thoughtful feedback :)
I ran into the need while working on a personal project, and it felt like a fairly common interaction pattern for confirm flows (especially when an action may take a bit longer). Maybe DataViews will eventually need something like this. I believe that if we want the ecosystem to stay aligned with the design direction of the admin, having flexible, open components helps a lot (I believe if certain components are meant to be used only within gutenberg core, we can always make that explicit by marking them as private).
Totally! composing your own modal is always an option. At the same time, having ready-to-use, extensible components makes things much smoother for plugin authors and extenders and reduces the amount of duplicated UI logic across the ecosystem.
Sounds good. I'll update the PR. |
ntsekouras
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I think it's fine to add this prop to this component to enable 3rd party devs (and most probably in GB in the future) to avoid creating custom confirm dialogs with Modal. I'd appreciate a confirmation from @aduth before landing though, as he's more into the components package.
Thanks!
|
Flaky tests detected in e9c7ca0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19225709746
|
|
No blockers from me 👍 |
|
Thank you 🙌 |
What?
Closes #73038
Introducing an isBusy prop to the component. When enabled, the dialog buttons would be disabled, and the confirm button would display a busy state. This would give users a clear visual cue that the action is processing, while still allowing them to dismiss the dialog by clicking outside of it if needed.
Why?
When a
ConfirmDialogaction takes a while to complete (for example, deleting a large number of records), there’s no indication that the process is underway. This leaves users unsure whether anything is happening. From a UX perspective, adding an isBusy prop will provide clear feedback that the action has started and is still in progress.How?
Testing Instructions
nvm use && npm run storybook:devScreenshots or screencast
confirmdialog-isbusy.mp4