v5 alpha .nav-link transition and flashing borders
See original GitHub issueIn v5alpha I noticed a flashing of the tab borders on loading the page and I think it’s related to the added transitions: https://github.com/twbs/bootstrap/pull/29988
I added a testcase, but also let me add a gif[1] and a video:
Full video: https://imgur.com/a/LR0e1zT
I reload the page, the tabs are being rendered with all blue borders and then the transparent border is being applied, with a transition (I throttled the connection/CPU in Dev Tools).
I can reproduce it by toggling the border and when I remove the transition from .nav-link
there is no flashing anymore.
The gif and the video was made in a Chrome browser that’s filled to the brim with extensions! I tested the same on a clean Chrome browser and the effect was much less visible and I couldn’t capture it with the screenrecorder, but it’s there!
- Chrome 83 Windows
- Testcase https://codepen.io/localhorst/pen/GRoWYRW
[1]: it looks like github remove the animation or just plays it once?!.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
I was investigating this more, because it was bothering me.
TL;DR this only occurs if there is no
script
tag in the page.Here is how you can hopefully reproduce the bug:
The reason why it was not working in codepen’s Editor View in @XhmikosR example was a) because Codepen injects extra
script
tags and b) @XhmikosR included the bootstrap JSSo it is only flashing if there are no
<script>
tag on the page and the css is external. Inlining bootstrap would fix it.This should show the flashing:
The fix is to put an “almost empty”
<script>
tag before</head>
like this:There are instances where a script tag in the body fixed it for people, there is a bug report for chrome related to input fields and transitions on load. In this particular case it only worked with empty script in the header.
This https://stackoverflow.com/a/42969608/814031 helped me fixing it.
I know this is nothing Bootstrap specific, but I thought it’s maybe good to have it document here.
Same issue observed, additionally this seems to happen on input borders as well Attached is behavour on the tabs as well, although styled, its still done with source sass from a few days ago
Chrome: 84 And only plugin is adblock
For me it seems the faster you page rendering is, the more visible this becomes, which is quite a problem obtimizing for webvitals