Bartosz Dziewoński has uploaded a new change for review.
https://gerrit.wikimedia.org/r/179523
Change subject: Account for <html> rather than <body> being the scrollable root
in Chrome
......................................................................
Account for <html> rather than <body> being the scrollable root in Chrome
Follow-up to 2674d311.
Bug: T70370
Change-Id: I5396f976db112c015c7b6104fd79c98c38420257
---
M src/Element.js
M src/elements/ClippableElement.js
2 files changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/23/179523/1
diff --git a/src/Element.js b/src/Element.js
index b26e446..f2f8a48 100644
--- a/src/Element.js
+++ b/src/Element.js
@@ -378,8 +378,8 @@
$win = $( this.getWindow( el ) );
// Compute the distances between the edges of el and the edges of the
scroll viewport
- if ( $sc.is( 'body' ) ) {
- // If the scrollable container is the <body> this is easy
+ if ( $sc.is( 'html, body' ) ) {
+ // If the scrollable container is the root, this is easy
rel = {
top: eld.rect.top,
bottom: $win.innerHeight() - eld.rect.bottom,
diff --git a/src/elements/ClippableElement.js b/src/elements/ClippableElement.js
index 36e8a70..e7eafff 100644
--- a/src/elements/ClippableElement.js
+++ b/src/elements/ClippableElement.js
@@ -68,9 +68,9 @@
this.clipping = clipping;
if ( clipping ) {
this.$clippableContainer = this.$(
this.getClosestScrollableElementContainer() );
- // If the clippable container is the body, we have to
listen to scroll events and check
+ // If the clippable container is the root, we have to
listen to scroll events and check
// jQuery.scrollTop on the window because of browser
inconsistencies
- this.$clippableScroller = this.$clippableContainer.is(
'body' ) ?
+ this.$clippableScroller = this.$clippableContainer.is(
'html, body' ) ?
this.$( OO.ui.Element.static.getWindow(
this.$clippableContainer ) ) :
this.$clippableContainer;
this.$clippableScroller.on( 'scroll',
this.onClippableContainerScrollHandler );
@@ -164,7 +164,7 @@
var buffer = 7, // Chosen by fair dice roll
cOffset = this.$clippable.offset(),
- $container = this.$clippableContainer.is( 'body' ) ?
+ $container = this.$clippableContainer.is( 'html, body' ) ?
this.$clippableWindow : this.$clippableContainer,
ccOffset = $container.offset() || { top: 0, left: 0 },
ccHeight = $container.innerHeight() - buffer,
--
To view, visit https://gerrit.wikimedia.org/r/179523
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5396f976db112c015c7b6104fd79c98c38420257
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits