mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Don't focus template input fields (and open keyboard) on mobile
On mobile, tapping anything in the sidebar should only scroll the corresponding element into view, but not focus the input field. The reasoning is that an on-screen keyboard should only pop up when the input field is actually tapped. By the way, the "jump" issue in T312768 was because of the same reason. In that case an onFocus happens before we have a chance to scroll. Unfortunately there is no way to reverse the execution order of these. Which is why we disabled the animation there. Bug: T289043 Change-Id: I1c18802b8ff776fa8d9c17e3df8020354690d29f
This commit is contained in:
parent
47d0d5075d
commit
d10dd4ded0
|
@ -140,14 +140,19 @@ ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.focusPart = function ( pageNam
|
|||
*/
|
||||
ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.onSidebarItemSelected = function ( pageName, soft ) {
|
||||
this.setPage( pageName );
|
||||
if ( !soft ) {
|
||||
this.focus();
|
||||
}
|
||||
|
||||
var page = this.pages[ pageName ];
|
||||
if ( page ) {
|
||||
// Warning, scrolling must be done before focussing. The browser will trigger a conflicting
|
||||
// scroll when the focussed element is out of view.
|
||||
page.scrollElementIntoView( { alignToTop: true, padding: { top: 20 } } );
|
||||
}
|
||||
|
||||
// We assume "mobile" means "touch device with on-screen keyboard". That should only open when
|
||||
// tapping the input field, not when navigating in the sidebar.
|
||||
if ( !soft && !OO.ui.isMobile() ) {
|
||||
this.focus();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue