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(material/tabs): avoid pagination infinite loop in safari #29121

Merged
merged 1 commit into from
May 28, 2024

Conversation

crisbeto
Copy link
Member

Fixes a bug reported internally where the tabs pagination was going into an infinite loop at some widths.

The root cause is a bit unclear, but it looks like in some cases Safari rounds up the scrollWidth and in some it doesn't which we end up hitting when adding/removing the pagination.

These changes work around it by adding a 5px threshold that needs to be crossed before we start showing the pagination. The threshold shouldn't be noticable for users since the tabs have a 24px padding on each side.

Fixes a bug reported internally where the tabs pagination was going into an infinite loop at some widths.

The root cause is a bit unclear, but it looks like in some cases Safari rounds up the `scrollWidth` and in some it doesn't which we end up hitting when adding/removing the pagination.

These changes work around it by adding a 5px threshold that needs to be crossed before we start showing the pagination. The threshold shouldn't be noticable for users since the tabs have a 24px padding on each side.
@crisbeto crisbeto added G This is is related to a Google internal issue target: patch This PR is targeted for the next patch release labels May 26, 2024
@crisbeto crisbeto self-assigned this May 28, 2024
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label May 28, 2024
@crisbeto crisbeto merged commit cc00a74 into angular:main May 28, 2024
23 of 27 checks passed
crisbeto added a commit that referenced this pull request May 28, 2024
Fixes a bug reported internally where the tabs pagination was going into an infinite loop at some widths.

The root cause is a bit unclear, but it looks like in some cases Safari rounds up the `scrollWidth` and in some it doesn't which we end up hitting when adding/removing the pagination.

These changes work around it by adding a 5px threshold that needs to be crossed before we start showing the pagination. The threshold shouldn't be noticable for users since the tabs have a 24px padding on each side.

(cherry picked from commit cc00a74)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker G This is is related to a Google internal issue target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants