jenkins-bot has submitted this change and it was merged. (
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, 22 insertions(+), 13 deletions(-)
Approvals:
jenkins-bot: Verified
Jforrester: Looks good to me, approved
diff --git a/src/layouts/BookletLayout.js b/src/layouts/BookletLayout.js
index 9cb4d90..a89b522 100644
--- a/src/layouts/BookletLayout.js
+++ b/src/layouts/BookletLayout.js
@@ -185,12 +185,21 @@
* @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;
+ // If everything is unselected, do nothing
+ if ( !page ) {
+ return;
+ }
+ // For continuous BookletLayouts, scroll the selected page into view
first
+ if ( this.stackLayout.continuous && !this.scrolling ) {
+ promise = page.scrollElementIntoView();
+ } else {
+ promise = $.Deferred().resolve();
+ }
+ // Focus the first element on the newly selected panel
+ if ( this.autoFocus && !OO.ui.isMobile() ) {
+ promise.done( function () {
+ layout.focus();
} );
}
};
diff --git a/src/layouts/IndexLayout.js b/src/layouts/IndexLayout.js
index 3b2796d..22bcc1a 100644
--- a/src/layouts/IndexLayout.js
+++ b/src/layouts/IndexLayout.js
@@ -137,13 +137,13 @@
* @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();
- }
- } );
+ // If everything is unselected, do nothing
+ if ( !tabPanel ) {
+ return;
+ }
+ // Focus the first element on the newly selected panel
+ if ( 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: merged
Gerrit-Change-Id: I9238930fd852da437b94349cb0b88ce81964e4dc
Gerrit-PatchSet: 2
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits