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

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

Open
ciampo opened this issue Sep 4, 2024 · 1 comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@ciampo
Copy link
Contributor

ciampo commented Sep 4, 2024

Originally posted by @ciampo in #65047 (comment)

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 #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:

  • try and detect if the user is trying to go to the previous or to the next tabbable element;
  • add a onFocus event listener on the iframe, and:
    • if the user wanted to go to the next tabbable, move focus to the first tabbable element inside the iframe;
    • if the user wanted to go to he previous tabbable, move focus to the first tabbable element before the iframe;

Not sure how robust this approach would be, though.

@ciampo ciampo added [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Sep 4, 2024
@andrewserong
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants