Bartosz Dziewoński has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/381826 )
Change subject: IndexLayout, BookletLayout: Don't scroll panels if we're not
scrollable
......................................................................
IndexLayout, BookletLayout: Don't scroll panels if we're not scrollable
Don't try to scroll panels into view if the layout is not scrollable
('continuous: true'). This is a no-op normally and causes weird
interactions with 'expanded: false' (introduced in eb91004c).
IndexLayout can never be scrollable, so just remove the code there.
Change-Id: I9238930fd852da437b94349cb0b88ce81964e4dc
---
M src/layouts/BookletLayout.js
M src/layouts/IndexLayout.js
2 files changed, 14 insertions(+), 13 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/26/381826/1
diff --git a/src/layouts/BookletLayout.js b/src/layouts/BookletLayout.js
index 9cb4d90..a8d5854 100644
--- a/src/layouts/BookletLayout.js
+++ b/src/layouts/BookletLayout.js
@@ -185,12 +185,17 @@
* @param {OO.ui.PanelLayout|null} page The page panel that is now the current
panel
*/
OO.ui.BookletLayout.prototype.onStackLayoutSet = function ( page ) {
- var layout = this;
- if ( !this.scrolling && page ) {
- page.scrollElementIntoView().done( function () {
- if ( layout.autoFocus && !OO.ui.isMobile() ) {
- layout.focus();
- }
+ var promise, layout = this;
+ // For continuous BookletLayouts, scroll the selected page into view
first
+ if ( this.stackLayout.continuous && !this.scrolling && page ) {
+ promise = page.scrollElementIntoView();
+ } else {
+ promise = $.Deferred().resolve();
+ }
+ // Focus the first element on the newly selected panel
+ if ( page && this.autoFocus && !OO.ui.isMobile() ) {
+ promise.done( function () {
+ layout.focus();
} );
}
};
diff --git a/src/layouts/IndexLayout.js b/src/layouts/IndexLayout.js
index 3b2796d..3ffda5b 100644
--- a/src/layouts/IndexLayout.js
+++ b/src/layouts/IndexLayout.js
@@ -137,13 +137,9 @@
* @param {OO.ui.PanelLayout|null} tabPanel The tab panel that is now the
current panel
*/
OO.ui.IndexLayout.prototype.onStackLayoutSet = function ( tabPanel ) {
- var layout = this;
- if ( tabPanel ) {
- tabPanel.scrollElementIntoView().done( function () {
- if ( layout.autoFocus && !OO.ui.isMobile() ) {
- layout.focus();
- }
- } );
+ // Focus the first element on the newly selected panel
+ if ( tabPanel && this.autoFocus && !OO.ui.isMobile() ) {
+ this.focus();
}
};
--
To view, visit https://gerrit.wikimedia.org/r/381826
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9238930fd852da437b94349cb0b88ce81964e4dc
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