nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - Tab component breaks cursor movement and styling in RTL direction after selection (v2.8.5)

Open Parsa5436 opened this issue 1 year ago • 5 comments

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

  1. Set page direction to RTL (dir="rtl")
  2. Use the Tab component with selectedKey and onSelectionChange props
  3. Click on any tab item
  4. 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

Parsa5436 avatar Oct 14 '25 20:10 Parsa5436

ENG-2846

linear[bot] avatar Oct 14 '25 20:10 linear[bot]

Thanks for reporting. Another reproducible example: https://storybook.heroui.com/?path=/story/components-tabs--default&globals=backgrounds.grid:!false;locale:he-IL

wingkwong avatar Oct 15 '25 04:10 wingkwong

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 avatar Oct 15 '25 07:10 Parsa5436

@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

wingkwong avatar Oct 16 '25 10:10 wingkwong

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) 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

Parsa5436 avatar Oct 16 '25 15:10 Parsa5436