-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
DataViews: Refactor actions to render modal outside the menu #67664
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. |
Size Change: +27 B (0%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
Flaky tests detected in 6d82ff8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12195504219
|
6d82ff8
to
60a983e
Compare
setActiveModalAction( action ); | ||
return; | ||
} | ||
action.callback( [ item ], { registry } ); |
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.
I've noticed the addition of the registry. Was some action not working because it didn't have access to it?
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.
I didn't notice anything in this PR, but it seemed like it wasn't omitted intentionally before (trunk). It's part of the callback
props and actions API will be open for extenders in the near future that should have access to registry, no?
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.
I was curious because if none of the actions actually needed, we could remove it.
<Modal | ||
title={ action.modalHeader || label } | ||
__experimentalHideHeader={ !! action.hideModalHeader } | ||
onRequestClose={ closeModal ?? ( () => {} ) } |
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.
If we need to keep track of the active action that triggered the modal, is there any case in which the closeModal
is not required now?
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.
(same thought for the RenderModal
prop of the ActionModal
interface)
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.
I can't figure out why we had that check in the first place. It seems we always passed that. I'll update the check and the types.
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.
I left a comment about making onClosed
required now, but other than that this seems ready.
…Press#67664) Co-authored-by: ntsekouras <[email protected]> Co-authored-by: oandregal <[email protected]> Co-authored-by: ciampo <[email protected]> Co-authored-by: doekenorg <[email protected]>
What?
Resolves: #66808
Currently on trunk when an action renders a modal, we keep the menu open because the modal is rendered within the
menu item
.In many cases some actions don't need to keep the menu open after selecting them and the current implementation leads to more unnecessary clicks for users. Additionally it seems it's a quite common practice to close the menus after selecting an action (see comment) .
This PR closes the menu when a user selects an action which also matches the behavior for actions that do not render a modal.
Testing Instructions
actions and bulk actions
in DataViews should work as before. You should also explicitly checklist
layouts, as they were using the actions dropdown a bit differently, due to different markup for keyboard navigation.