JGonera has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/60691


Change subject: Don't use focus event for the search input
......................................................................

Don't use focus event for the search input

Use touchend and keydown instead. This way the search overlay is shown
only when someone taps the input or starts typing in it. The overlay is
not shown anymore when someone uses Tab or Shift+Tab to navigate the
page. Also fixes Kindle annoyances.

Bug: 47499
Change-Id: I99347dd90a20e796551a1ce6aed47278fcb40c0e
---
M javascripts/modules/search-2.js
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/91/60691/1

diff --git a/javascripts/modules/search-2.js b/javascripts/modules/search-2.js
index daadb98..affa13f 100644
--- a/javascripts/modules/search-2.js
+++ b/javascripts/modules/search-2.js
@@ -108,8 +108,13 @@
 
 function init() {
        var searchOverlay = new SearchOverlay();
-       $( '#searchInput' ).on( 'focus', function() {
-               searchOverlay.showAndFocus();
+       // don't use focus event 
(https://bugzilla.wikimedia.org/show_bug.cgi?id=47499)
+       $( '#searchInput' ).on( 'touchend keydown', function( ev ) {
+               var keyCode = ev.keyCode || ev.which;
+               // if touch or key not Tab or Shift
+               if ( ev.type === 'touchend' || ( keyCode !== 9 && keyCode !== 
16 ) ) {
+                       searchOverlay.showAndFocus();
+               }
        } );
 }
 init();

-- 
To view, visit https://gerrit.wikimedia.org/r/60691
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99347dd90a20e796551a1ce6aed47278fcb40c0e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: JGonera <jgon...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to