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

Entity saved modal dialog closes unexpectedly #67313

Open
2 of 6 tasks
afercia opened this issue Nov 26, 2024 · 3 comments · May be fixed by #67327
Open
2 of 6 tasks

Entity saved modal dialog closes unexpectedly #67313

afercia opened this issue Nov 26, 2024 · 3 comments · May be fixed by #67327
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Editor /packages/editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Nov 26, 2024

Description

When clicking the 'padding area' of the Entity saved modal dialog, the modal dialog closes unexpectedly.

Animated GIF to illustrate:

Image

Turns out this modal dialog content, the EntitiesSavedStatesExtensible component, uses the useDialog hook to attach modal behaviors to the content. It is then used inside a Modal dialog. Basically, from a functional perspective, this is a Modal within a Modal.

That explains why clicking outside the 'inner modal' (the content) closes the modal. In fact, clicking outside the area highlighted in the screenshot below but still inside the 'outer modal' closes the modal.

Image

Step-by-step reproduction instructions

  • Go to the Site editor.
  • Make a simple change to a global style, e.g. change a color.
  • Reopen the Navigation panel by clicking 'Open Navigation' at the top left of the screen.
  • Click any item in the navigation other than 'Styles' e.g. click 'Pages' or 'Templates'.
  • At this point, a blue button at the bottom of the Navigation panel appears, labeled 'Review 1 change...'

Image

  • Click the button: the modal dialog to save entities opens.
  • Click the padding area of the modal dialog.
  • Observe the modal dialog closes.
  • Alternatively preview a block theme from the WP admin > Appearance > any block theme > Live Preview.
  • Click the blue button labeled 'Activate {theme name}' at the bottom of hte Navigation panel: the modal dialog to save entities opens.
  • Click the padding area of the modal dialog.
  • Observe the modal dialog closes.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@afercia afercia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended labels Nov 26, 2024
@afercia afercia self-assigned this Nov 26, 2024
@afercia
Copy link
Contributor Author

afercia commented Nov 26, 2024

I guess the reason why EntitiesSavedStatesExtensible gets the modal props via useDialog ie because this component is also rendered in the right panel when saving entities:

Image

In this case, EntitiesSavedStatesExtensible is not inside a Modal dialog. The 'close when clicking outside' behavior may make sense in this case. However, this is inconsistent with other similar panels. For example, the pre-publish checks panel doesn't close when clicking outside of it.

What is the reason why the entities saved panel should close when clicking outside? I'm not sure this behavior adds value from an user experience perspective. It just introduces an inconsistent behavior. As an user, I would be confused and prefer this panel to stay open untile I close it.

Cc @WordPress/gutenberg-design any objection to remove the 'close on click outside' behavior from the entities saved panel?

@afercia
Copy link
Contributor Author

afercia commented Nov 26, 2024

Relevant previous change: #59622

@Mayank-Tripathi32
Copy link

Hey @afercia,

What do you think about adding a flag in useDialog to disable the behavior for specific places as needed? I’ve tried a simple approach and will open a sample PR for you to review.

Looking forward to your feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Editor /packages/editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants