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: Keyboard navigation and indicator issues in RTL languages #64963

Closed
4 tasks done
t-hamano opened this issue Sep 1, 2024 · 7 comments
Closed
4 tasks done

Tabs: Keyboard navigation and indicator issues in RTL languages #64963

t-hamano opened this issue Sep 1, 2024 · 7 comments
Labels
l10n Localization and translations best practices [Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Comments

@t-hamano
Copy link
Contributor

t-hamano commented Sep 1, 2024

Description

I think there are two problems with the Tabs component in RTL languages.

⚒️ Keyboard Navigation

Note: This problem occurs not only in the Tab component, but also in the following two components:

When I press the left or right key, I expect the focus to move to the tab in that direction. However, in RTL languages, the direction of the key and the direction in which the focus actually moves are opposite:

22a2f1bd4be87fd6cdd8189c7723e39a.mp4

From what I understand, this component is based on @ariakit/react.

Therefore, when I tested the ariakit Tab component itself, the problem seemed to be reproduced in the same way. I tested it by adding direction:rtl to the html element on the component preview page:

d51cbeee08a2bed5e81e548291e62fc0.mp4

✅ Indigator position

(Fixed in #64926)

When the browser width changes, the indicator position is misaligned:

8e9e44481a7565e73ff6b7da9243761f.mp4

Probably in RTL languages, ​​we need to calculate the right position instead of the left position:

'--indicator-left': `${ indicatorPosition.left }px`,

Step-by-step reproduction instructions

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
@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Package] Components /packages/components l10n Localization and translations best practices labels Sep 1, 2024
@DaniGuardiola
Copy link
Contributor

I think we should file the keyboard issue in the Ariakit repo, cc @diegohaz for visibility too.

@DaniGuardiola
Copy link
Contributor

All indicator issues are fixed in #64926.

@diegohaz
Copy link
Member

diegohaz commented Sep 2, 2024

The rtl prop must be explicitly set. Related: ariakit/ariakit#2930 (comment)

@t-hamano
Copy link
Contributor Author

I found that this problem occurs not only in the Tabs component but also in other components. As far as I could tell, it occurs in the following two components:

@mirka
Copy link
Member

mirka commented Sep 30, 2024

@ciampo
Copy link
Contributor

ciampo commented Oct 17, 2024

@ciampo
Copy link
Contributor

ciampo commented Oct 17, 2024

Closing this issue as all flagged components have been improved

@ciampo ciampo closed this as completed Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l10n Localization and translations best practices [Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants