-
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
Snackbar: Display Snackbar
on top of Modal Screen Overlay
#68728
Comments
Displaying the
If the |
In normal flow, you just dismiss "Snackbar" and continue doing what you did. But with the modal, you'll have to re-open it, which could be inconvenient. I don't have an answer to what's the best UX here; this is why I requested additional feedback before we try to solve anything. |
Given this, maybe the snackbar isn't the right choice. Instead, should we show the notification inside a modal, like the font library modal? Or, if the modal was to be closed when the pattern was inserted, the current snackbar would make sense. When the pattern modal was first implemented, it seemed to close the modal when the pattern was inserted (see the video attached to #35773). It might be a good idea to first look into when and why this behavior was changed. |
I'd agree this should be investigated to understand what the reasoning behind the change was. Edit: In WordPress 6.6 the Patterns explorer modal dialog closes when inserting a pattern so the change in behavior must be pretty recent. |
Raising this issue to In fact, when using the keyboard and inserting a pattern from the modal dialog, the dialog stays open and focus moves to the inserted pattern in the editor canvas. As such, focus is outside the modal dialog, which is something that should never happen. I do realize that when using the mouse this regression isn't immediately clear but this only proves that whatever the change that introduced this bug is, it hasn't been tested sufficiently with keyboard. This is far from ideal as largely untested changes keep being introduced in the UI often breaking basic interaction flows. To reproduce.
Screenshot:
Wondering whether we should close this issue and create a new one to report the root cause of the bug: the modal dialog should close. |
I would like to investigate this point first. |
I identified this behavior as being changed in #63059. The discussion in #61051 was about whether to keep the sidebar inserter open or not. It seems that they ultimately agreed on a policy of not closing the sidebar inserter when clicking on the canvas. However, there was no mention of the Pattern Explorer modal, so the current behavior may not be what was intended. Perhaps we need to decide which is the ideal behavior for the pattern explorer modal. When we click on a pattern in the pattern explorer modal:
|
Thanks a lot for this research. As this might not be the intended effect, I favor implementing "Close the modal. Show a snackbar. Focus the inserted pattern." I will be updating the existing PR to reflect the same. What are your thoughts? |
Thanks for tracking down the change that introduced this regression. So, to my understanding, the modal dialog used to close when inserting a pattern only because the Inserter panel used to close in the first place? Interesting. Personally, I'm not sure the modal dialog should close automatically on insertion.
|
Stupid question: can't we just make sure that the modal height leaves the space for the snackbar to show? The content is already scrollable. |
It might solve the visual problem, but it doesn't solve the accessibility problem. I think the outside of the modal needs to be inert. |
Yes, anything outside of the modal dialog is already not perceivable. The Modal component adds As such, the Snackbar is not perceivable by assistive technology. Instead, the |
The current behavior of the Pattern Explorer modal is an unintended change introduced in #63059. Therefore, I propose to at least revert to the previous behavior, where clicking on any pattern in the Patterns modal closes the modal and focuses the inserted pattern. This is also important to fix the accessibility regression below:
After that, we can consider more advanced improvements like these:
Incidentally, the original suggestion in this issue was about the stacking order of snackbars and modal screen overlays. Given the discussion so far, the current behavior may be correct. It may be best to avoid using the modal + snackbar pattern instead. |
I'd agree this seems to be the most reasonable thing to do for now because, as pointed out, it's an unintended change that introduced a regression. |
Thanks for the great discussions! 🚀 I've linked a PR that restores the previous behavior. 🔄 |
Description
The
z-index
of thesnackbar
component currently matches that of themodal screen overlay
:gutenberg/packages/base-styles/_z-index.scss
Lines 113 to 117 in 064b879
As a result, the
snackbar
is rendered behind themodal overlay
. Sincesnackbars
provide critical feedback for user actions, they should ideally appear above themodal overlay
to ensure their visibility.For example, when inserting a
Pattern
through theExplore all patterns
modal, selecting a pattern successfully adds it to the post content and triggers asnackbar
notification. However, because thesnackbar
is hidden behind themodal overlay
, users cannot see the feedback. This behavior does not provide proper feedback to the user and forces them to close the modal to confirm the action manually.This behavior is demonstrated more clearly in the attached video.
Step-by-step reproduction instructions
post edit
screen.Block Inserter
.Patterns
tab and open theExplore all patterns
dialog.Pattern
from theDialog
.snackbar
got generated behind theDialog
.Screenshots, screen recording, code snippet
issue.mov
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: