-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix Safari docs crash #6930
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 Safari docs crash #6930
Conversation
window.addEventListener('load', () => listen()); | ||
} | ||
|
||
let raf = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just some defensive code
Nice one 🙌 Can confirm it fixed the issue for me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the issue when zooming. I'll have to re-test this after release to see if it fixes the crashing I experience in the production build without zooming. That could be a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verified that I could now reproduce the previous issue on prod docs in Safari and that the changes here have fixed the crash
Closes #5068
I was able to debug with my local build
We were getting into a state where the offsetWidth was within 1px of the scrollWidth, resulting in trying to make the font ever smaller since there was no guard against it getting too small/negative
The reason we were within 1px is that Safari seems to
floor
clientWidth when other browsers doround
, so I've added a + 1 to account for that. I tried using the bounding client rect and rounding myself, but for some reason, it sometime suffer from being a pixel off as well. So it may be a deeper rounding issue than I can account for.the + 1 discrepancy doesn't appear to harm anything and it was taking wayyyy too much of my time to try to fix it.
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: