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

fix(TabIndicator): avoid bg flash when long tab text #5665

Conversation

josulliv101
Copy link
Contributor

Closes (#5664)

📝 Description

Add "width" to the list of transitionProperties of the TabIndicator to prevent the background from overlapping adjacent tabs. This issue occurs when one tab's width is larger than the other tabs.

⛳️ Current behavior (updates)

The transition behavior when the selected tab changes.

🚀 New behavior

Including "width" as a transition property of the TabIndicator prevents any overlapping when the selected tab changes (assuming the tabs differ in width so the issue shows itself)

💣 Is this a breaking change (Yes/No):

No

📝 Additional Information

Example of the issue:
https://codesandbox.io/s/pedantic-dawn-ds3hfu?file=/src/index.tsx

I did not include a test since the nature of the issue is more visual/timing related -- it seemed hard to create a test to capture that.

@changeset-bot
Copy link

changeset-bot bot commented Feb 28, 2022

🦋 Changeset detected

Latest commit: 512e660

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@chakra-ui/tabs Patch
@chakra-ui/react Patch
@chakra-ui/props-docs Patch
@chakra-ui/test-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Feb 28, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui-storybook/XPFZH8qoEJLU94DBhFoCVJEg7Fx9
✅ Preview: https://chakra-ui-storybook-git-fork-josulliv101-fix-t-c3c27e-chakra-ui.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 28, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 512e660:

Sandbox Source
create-react-app-ts Configuration
wonderful-mclaren-2160qy PR

@@ -449,7 +444,7 @@ export function useTabIndicator(): React.CSSProperties {

return {
position: "absolute",
transitionProperty: "left, right, top, bottom",
transitionProperty: "left, right, top, bottom, width",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess height should be included here as well, in the case of vertical tabs. Right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I've included height now as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants