WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.48k stars 4.18k forks source link

Make all popovers implement a modal behavior #56077

Open afercia opened 11 months ago

afercia commented 11 months ago

Description

Splitting this out from https://github.com/WordPress/gutenberg/pull/56042#issuecomment-1807695604

Turns out most of the popovers in the editor UI do implement constrained tabbing but some don't. I'm not sure what the reasoning behing this inconsistent is, but I'd tend to think all the popovers should implement a consistent keyboard interaction, regardless whether the component is 'inline' within the post content or in other parts of the UI.

Step-by-step reproduction instructions

There may be other instances of popovers where tabbing is not constrained. To me, it seems there is no good reason why popovers should not constrain tabbing. The keyboard interaction should always be the same: predictable and consistent. I'd like to hear thoughts also from @alexstine and @joedolson

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

alexstine commented 11 months ago

@afercia I tend to agree but also note that some popovers don't take focus by default. The AutocompleteUI for example.

CC: @getdave.

afercia commented 11 months ago

Thanks @alexstine

getdave commented 11 months ago

I started looking into dialogs on Link Control here https://github.com/WordPress/gutenberg/pull/54063 although it's clearly a work in progress and should be considered with that in mind.

mdrovdahl commented 1 month ago

I think related...the tab behavior in the Link Control edit mode within the Patterns context is suboptimal. Additionally, this Link Control behavior in the Patterns context is inconsistent with same control in the post editor context.

Steps to reproduce:

  1. Create a new site via Playground (https://playground.wordpress.net)
  2. Navigate to: Appearance > Editor > Patterns > Add New Pattern
  3. Within the default paragraph block, create and save some hyperlinked text
  4. Edit the hyperlink, change the text
  5. Press tab twice and the dialog closes without saving the changes from step 4

https://github.com/user-attachments/assets/6dc16e79-0008-471b-9fb2-94b61dbcae7a