-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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: Loading spinner animation misalignment #8595
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8595 +/- ##
==========================================
+ Coverage 82.71% 82.77% +0.06%
==========================================
Files 113 113
Lines 7636 7636
Branches 1835 1835
==========================================
+ Hits 6316 6321 +5
+ Misses 1320 1315 -5 ☔ View full report in Codecov by Sentry. |
@roman-bc-dev this should no longer be the case since this #8369. Is it possible to have an example to reproduce the issue? I did a quick test of this PR and it seems to bring the issue back. Screencast.from.16.02.24.19.16.13.webm |
I was able to reproduce the issue by doing: player.loadingSpinner.lockShowing() If it's the case I would do something like #8435 instead. |
Hi @amtins. I'm able to reproduce this issue consistently in local videojs samples by updating visibility on the
I might be misinterpreting how Furthermore, because the pseudo-elements are affected by |
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.
Looks good to me! Was able to reproduce the issue in several of the sandbox player samples, and the left: -0.6em; top: -0.6em;
fixed it 😁
@roman-bc-dev basically, .vjs-loading-spinner.vjs-lock-showing {
display: flex !important;
justify-content: center;
align-items: center;
} The problem with the proposed fix is that if you change the thickness of the player.loadingSpinner.el().style.borderWidth = '.2em'; Do you encounter this problem only with |
@usmanonazim could you share in which sandbox example you have the problem, I can't reproduce the problem unless I use |
@amtins This is a weird issue that seems to affect the spinner and its visibility outside of the
Editor's note here: The proposed change also doesn't interact with how
|
Thanks for the clarification 👍🏽. Since change #8369 the loading-spinner uses centering with There are several solutions, depending on the experience you wish to offer developers:
To illustrate my point, here's an example:
|
Thank you @Essk for finding this. It looks like videojs-contrib-ads has its own class/rules to make the spinner appear, which explains why we're seeing this behavior in connection with an ad implementation. I'll submit a change for that project. However, I think we may still want to move forward with the positioning rules here as a default state when
|
Closing this since the associated fix seems to have been enough to address the issue on our end. The points I made above back in February don't seem relevant since we'd have seen feedback about the flex update since then. |
Description
Add top/left positioning rules to the
.vjs-loading-spinner:before
and.vjs-loading-spinner:after
to fix the loading spinner animated segment misalignment.This seems to occur because the
border: 0.6em
rule on the.vjs-loading-spinner
parent effectively pushes content inward with the current box-model interpretation, against a set height/width, like padding. Unlike padding, however, the edge of the element box is interpreted as inside the border, not outside, so the spinner segment pseudo-elements inheriting its positioning rules are visually nudged downward and to the right.Adding negative top/left positioning rules to account for the border fixes the misalignment. It's most likely why there was a negative margin in place for the segments in the past.
Specific Changes proposed
Add top/left positioning rules targeting
.vjs-loading-spinner::before, .vjs-loading-spinner::after
Requirements Checklist