-
Notifications
You must be signed in to change notification settings - Fork 26.2k
ViewportScroller getScrollPosition does not work in Internet Explorer #27957
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
Comments
This happens because This seems to be incorrectly feature-detected earlier in the function by |
Why not update ViewportScroller to get viewport scroll position like material2? -- In-app fix: adding a polyfill in Example for IE11: // src/polyfills
if (!('scrollX' in window)) {
Object.defineProperty(window, 'scrollX', { get: () => window.pageXOffset });
}
if (!('scrollY' in window)) {
Object.defineProperty(window, 'scrollY', { get: () => window.pageYOffset });
} |
It seems to me that it would be enough to use the From https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX#Notes
These properties are supported by IE9-11: https://developer.mozilla.org/en-US/docs/Web/API/Window/pageXOffset#Browser_compatibility |
FYI, the corresponding PR #28262 that contains the fix was merged, so I'm closing this ticket. The fix should be available once the next release (11.0.3) is published. Thank you. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 bug report
Affected Package
The issue is caused by package
@angular/common
Is this a regression?
No
Description
viewportScroller.getScrollPosition()
returns[null,null]
in Internet Explorer🔬 Minimal Reproduction
https://stackblitz.com/edit/angular-issue-repro2-b8ydqs
View in Internet Explorer 11
🔥 Exception or Error
Scroll position: [ null, null ]
🌍 Your Environment
Angular Version:
Anything else relevant?
Tried Internet Explorer 11
The text was updated successfully, but these errors were encountered: