-
-
Notifications
You must be signed in to change notification settings - Fork 79k
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 Manipulator.offset()
#33603
Fix Manipulator.offset()
#33603
Conversation
eae9f25
to
3d14542
Compare
Alpa, sure is better than before. |
Is that issue really fix? I have the same behavior than before. #32496 |
Issue is still in bootstrap v5.0.1. #32496 have available finally any fixed? |
excuse my ignorance; but if a single DOMContentLoaded is placed; What will happen to the content added with bootstrap ajax, what is expected to have any interaction or effect, will it still work? |
@arcanisgk how is that related? |
@alpadev Correct me if I am wrong, but Manipulator methods |
@alpadev regarding your OP TODO
If you don't have further changes, we could include this in v5.0.2 |
Forgot to mention that if we already use |
@alpadev it seems we are getting random BrowserStack failures:
Maybe we need some timeout? |
It seems to me not to be completely random, it simply tries to execute at the same time as the resizing/changing the orientation of Mobile, it is not that it needs a time out I think it needs to know the status of the viewport. |
By random I mean it doesn't always happen as you can see by the current test status :) Anyway, if anyone has any patches, please make a new PR. |
I am almost certain that the event is intercepted in the rotation of a Mobile device: var supportsOrientationChange = "onorientationchange" in window,
orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";
window.addEventListener(orientationEvent, function() {
alert('HOLY ROTATING SCREENS BATMAN:' + window.orientation + " " + screen.width);
}, false); |
* test: add more test cases for Manipulator.offset() * fix: Manipulator.offset() is using obsolete properties to get scroll position Co-authored-by: XhmikosR <[email protected]> Co-authored-by: GeoSot <[email protected]>
@arcanisgk could you make a PR please? We keep hitting the CI failure but it's not 100% reproducible. |
@XhmikosR Hello, I'm sorry to tell you that I don't have the slightest idea what "PR" is; The most I have achieved in github is to create a personal repository upload a library and publish it to be distributed in composer, I would like to help more but I do not have enough knowledge to support them. |
No worries. We need someone to have a look at this issue at some point. I might create a new issue so that this gains more eyes. |
fixes #32496, closes #32341
Background
Manipulator.offset()
is usinggetBoundingClientRect()
that returns top/left values relative to the viewport. The current implementation usesdocument.body.scrollTop
anddocument.body.scrollLeft
to get the scroll position of the viewport. (Both returning 0 in current Chrome and FF)This used to work with older browsers but since then got changed to
document.documentElement.scrollTop
anddocument.documentElement.scrollLeft
. The currently proposed way to get those values (according to MDN) is to usewindow.pageYOffset
andwindow.pageXOffset
.TBD
Should we also add fallbacks for
window.pageYOffset
andwindow.pageXOffset
mentioned on the MDN page?Not sure about the test cases. Maybe someone got a better idea how to implement them.
Preview: https://deploy-preview-33603--twbs-bootstrap.netlify.app/docs/5.0/components/scrollspy/
Example of #32496 using the fix: https://codepen.io/-alpa-/pen/MWpVooG