WordPress / gutenberg

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

Style Book: iframe brings an additional tab stop in between tablist and tabpanel #65065

Open ciampo opened 1 month ago

ciampo commented 1 month ago

Originally posted by @ciampo in https://github.com/WordPress/gutenberg/issues/65047#issuecomment-2329250061

Something I've noticed is that there's a tab stop between the menu and the style book block examples. Haven't dug deeper, but it looks like it's focusing the iframe itself. This is pre-existing, but something to note and potentially fix.

Yeah, I noticed that too — it was added in https://github.com/WordPress/gutenberg/pull/48664 by @andrewserong , who added this paragraph in the PR description:

Note / caveat: because of lifting the iframe up to the root of the content area, I had to set the iframe to tabIndex=0 so that the buttons within it could be tabbed to. This seems to work pretty well, but means that the iframe itself now sits within the tab sequence of the style book. Happy for any suggestions on how to improve this.

We can't set tabindex="-1" on the iframe either, because that should skip its contents entirely. What we could do, is to:

Not sure how robust this approach would be, though.

andrewserong commented 1 month ago

Thanks for opening this issue! It was an unfortunate side-effect in #48664, but on balance appeared to be worth it for the performance and styling benefits of using a single iframe.

What we could do, is to:

Yes, effectively intercepting tabbing behaviour there and moving to the next / previous tabbable as appropriate seems to be about the most direct way to handle it I think.

Not sure how robust this approach would be, though.

Indeed, we'd likely need to test it quite carefully to make sure it's working as expected in all cases.