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

Tabs: focus style overlaps text when 'Show button text labels' preference is enabled #62018

Closed
afercia opened this issue May 27, 2024 · 1 comment · Fixed by #62027
Closed
Assignees
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Show button text labels A preference in the Post and Site Editor that makes buttons show text instead of icons [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Feedback Needs general design feedback. [Package] Components /packages/components [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 May 27, 2024

Description

The various panels in the editor may use content organized in two or three horizontal tabs.
Typically this is for some blocks inspector panel e.g. the Image and Navigation block but this design pattern is used also in the Glogabl styles panel and elsewhere.

The well known problem with horizontal tabs is that the layout may break when the horizontal space is limited. The editor panels do have limted space, as they are rendered in a narrow column.

As such, when the 'Show button text labels' preference is enabled and the editor is set to languages other than English, some translations provide longer strings that go in two or even three lines.

The focus style for the Tabs uses a CSS pseudo element that is positioned absolutely and draws the focus blue outline.
Additionally:

  • The tabs have a fixed height.
  • The vertical padding is insufficient.

The current CSS doesn't take into account longer strings and it appears it hasn't ever been tested with languages other than English.

Having an outline that draws a line on top of text isn't ideal as it partially obscures the text.

Fixed height on the web are often problematic. The desire of making a 'pixel perfect' design often clashes with the reality where content on the web is supposed to re-flow and adapt when strings are longer and / or the viewport changes.

Overall, the styling of the tabs should be adjusted to take into account longer strings by:

  • Avoiding to use a fixed height.
  • Provide sufficient vertical padding to reserve space for the focus style outline.

This problem can be reproduced when testing with languages that typically provide longer strings or do take more vertical space. Here's a couple screenshots witht the editor language set to Italian and Japanese:

focus style

focus style japanese

It would be worth to start a broader discussion about ways to make sure the Editor layout doesn't break with languages other than English. At the very lesst:

  • Testing with other languages should be part of any development that touches the UI and the base components.
  • Any design should take inco account languages other than English to start with.

Step-by-step reproduction instructions

  • Switch WordPress language to Italian or Japanese.
  • Go to the post editor and add a navigation block.
  • Go to Options > Preferences > Accessibility, and enable the 'Show button text labels' preference.
  • With the navigation block selected, observe the block inspector panel.
  • Use the Tab key to focus the first tab.
  • Use the right and left arrow keys to move through the tabs.
  • Observe the focus style appears on top of the text.

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

@afercia afercia added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Feedback Needs general design feedback. [Package] Components /packages/components CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Show button text labels A preference in the Post and Site Editor that makes buttons show text instead of icons labels May 27, 2024
@afercia
Copy link
Contributor Author

afercia commented May 27, 2024

The focus style isn't great even with strings that go to only two lines e.g. Spanish or French.

Screenshot 2024-05-27 at 11 42 01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Show button text labels A preference in the Post and Site Editor that makes buttons show text instead of icons [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Feedback Needs general design feedback. [Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
1 participant