Skip to content

Botch of focus return when dismissing Modal by clicking outside #51722

Closed

Description

@stokesman

Description

When a modal is dismissed, focus is expected to return to the element that opened the modal. This fails when dismissing a modal by clicking outside it.

Step-by-step reproduction instructions

  1. Start in the Post Editor
  2. Open the Options menu
  3. Open the Preferences modal
  4. Click outside the Preferences modal to dismiss it
  5. Observe the Options menu is still open and clicking or focus other elements does not cause it to close.

Screenshots, screen recording, code snippet

Here are a couple instances of the issue but there are more uses of Modal that are probably affected.

Preferences modal

Google.Chrome.-.Edit.Post.My.WordPress.Website.WordPress.2023-06-20.at.8.46.52.PM.mp4

Post visibility confimation dialog

This is a ConfirmDialog which is built on top of Modal. I would expect the visibility dropdown menu would stay open and the focus return to the 'private' radio.

Google.Chrome.-.Edit.Post.My.WordPress.Website.WordPress.2023-06-20.at.8.40.39.PM.mp4

Environment info

  • Gutenberg trunk running on wp-now
  • Chrome
  • macOS

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

Activity

  1. added
    [Package] Components
    [Type] Bug
    on Jun 21, 2023
  2. added
    [Status] In Progress
    on Jul 14, 2023
  3. added
    [Focus] Accessibility (a11y)
    and removed on Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Focus] Accessibility (a11y)[Package] Components[Status] In Progress[Type] Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions