Merge "Focus the input after switching to the content pane"

This commit is contained in:
jenkins-bot 2022-07-06 14:19:41 +00:00 committed by Gerrit Code Review
commit 9754f8fd8f
2 changed files with 7 additions and 2 deletions

View file

@ -371,6 +371,9 @@ ve.ui.MWTransclusionDialog.prototype.toggleSidebar = function ( expandSidebar )
dialog.sidebar.setSelectionByPageName( name );
} else {
selectedPage.scrollElementIntoView( { alignToTop: true, padding: { top: 20 } } );
if ( !OO.ui.isMobile() ) {
selectedPage.focus();
}
}
}, OO.ui.theme.getDialogTransitionDuration() );
}

View file

@ -133,8 +133,10 @@ ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.focus = function () {
if ( !page ) {
return;
}
// Only change the focus if is not already in the current page
if ( !OO.ui.contains( page.$element[ 0 ], this.getElementDocument().activeElement, true ) ) {
// Only change the focus if it's visible and is not already the current page
if ( page.$element[ 0 ].offsetParent !== null &&
!OO.ui.contains( page.$element[ 0 ], this.getElementDocument().activeElement, true )
) {
page.focus();
}
};