[BUG] - Tab component breaks cursor movement and styling in RTL direction after selection (v2.8.5)
HeroUI Version
2.8.5
Describe the bug
The Tab component from HeroUI works correctly in LTR direction but breaks when the page direction is set to RTL (dir="rtl"). After clicking on any tab item, the cursor indicator loses its styling and movement ability. The issue only appears after a tab is selected - the initial state works fine.
💻 Code Example
<Tabs
selectedKey={selectedTab}
onSelectionChange={setSelectedTab}
color={currentTab?.color || "primary"}
variant="bordered"
classNames={{
tabList: "w-full",
}}
>
{tabs.map((tab) => (
<Tab
key={tab.id}
title={
<div className="flex items-center gap-2">
<Icon icon={tab.icon} width={18} />
<span className="text-sm font-medium">{tab.label}</span>
</div>
}
/>
))}
</Tabs>
🚨 Actual Behavior
When dir="rtl" is set:
- Before clicking any tab: Everything works fine
- After clicking a tab: The cursor indicator disappears and tab styling breaks
🛠️ Possible Solution
The issue might be related to CSS transform or positioning calculations not accounting for RTL direction in the cursor animation logic.
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
- Set page direction to RTL (
dir="rtl") - Use the Tab component with
selectedKeyandonSelectionChangeprops - Click on any tab item
- Observe that the cursor indicator disappears and tab styling breaks
Expected behavior
The cursor indicator should move smoothly between tabs and maintain proper styling in RTL direction, just like it does in LTR.
Screenshots or Videos
No response
Operating System Version
Windows
Browser
Chrome
Thanks for reporting. Another reproducible example: https://storybook.heroui.com/?path=/story/components-tabs--default&globals=backgrounds.grid:!false;locale:he-IL
Thanks for reporting. Another reproducible example: https://storybook.heroui.com/?path=/story/components-tabs--default&globals=backgrounds.grid:!false;locale:he-IL
Thank you for your prompt response and for providing the Storybook example - I can confirm this reproduces the exact same issue we're experiencing.
I'd like to emphasize that this is affecting our production application, and our RTL users are currently experiencing broken tab functionality. This is a critical issue for us since tabs are a core navigation component in our application.
Would it be possible to prioritize this fix? Our team would greatly appreciate it if this could be addressed in the next patch release, as it's impacting our user experience in production.
If there's any way we can help expedite the process (testing, additional information, etc.), please let us know. We're happy to assist in any way we can.
Thanks again for your attention to this matter!
@Parsa5436 I've just created a PR. In case you need a urgent fix, you may consider to use the PR version: https://pkg.pr.new/@heroui/tabs@5816 (individual) or https://pkg.pr.new/@heroui/react@5816 (global)
With the same example with the fix: https://heroui-j12ifapn4-heroui.vercel.app/?path=/story/components-tabs--default&globals=backgrounds.grid:!false;locale:he-IL&strict=false
Thanks a lot! The fix works perfectly. Appreciate the fast response.🙏🙏
@Parsa5436 I've just created a PR. In case you need a urgent fix, you may consider to use the PR version:
https://pkg.pr.new/@heroui/tabs@5816(individual) orhttps://pkg.pr.new/@heroui/react@5816(global)With the same example with the fix: https://heroui-j12ifapn4-heroui.vercel.app/?path=/story/components-tabs--default&globals=backgrounds.grid:!false;locale:he-IL&strict=false