-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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] Fix an infinite loop #14664
[Tabs] Fix an infinite loop #14664
Conversation
Details of bundle changes.Comparing: 2f6a982...04261e2
|
@caroe233 Thank you for taking the time to submit a pull request. However, we need a reproduction example before considering any changes. Could you provide one? Thank you! |
Hi @oliviertassinari , this is the sandbox: https://codesandbox.io/s/13mwv6llxl?fontsize=14 For reproducing the error, open the link in EDGE, open the preview in a new window (or use the following link going to the separated preview: https://13mwv6llxl.codesandbox.io/ You should see four tabs. Then use your mousewheel to change the browser zoom to 105% and EDGE will crash. Hope that's what you were asking for :) |
- added a test to check the behavior
31957ce
to
04261e2
Compare
@caroe233 Thank you! an extra pixel won't harm :) |
I want the area for the scroll buttons of tabs to disappear when no scroll button should be displayed. Therefore I used CSS Override and set the width (or in this case the flexBasis) to 0:
This works fine most of the times, but in Edge with "weird" browser zoom factors, such as 105% it leads to an infinite loop. (I have not been able to reproduce this behavior with the standard zoom factors that are available in chrome...)
The code realizes that it needs to enable the left scroll button because the scrollWidth is bigger than the clientWidth. It then comes to the code and should realize that the scrollWidth is no longer bigger than (clientWidth + scrollLeft), but for some reason there seems to be a rounding issue for the scrollWidth property which leads to the scrollWidth property being 1px bigger than the (clientWidth + scrollLeft) property.
I fixed this by adding a "+ 1" to the condition to ignore rounding issues.