From 734a7f7222bfcfd2de30a1cec68a215a7e07af73 Mon Sep 17 00:00:00 2001 From: Alangi Derick Date: Thu, 9 Aug 2018 12:44:39 +0100 Subject: [PATCH] Set tabindex to 1 for the search box in Timeless skin When using the Vector skin, and you load a page and press the tab button on the keyboard once, the cursor focus on the search box, this is handy and now available on the timeless skin too. Also, removed target "mobile" as "jquery.tabIndex" dependency doesn't use it. Bug: T201424 Change-Id: I6e5d96371b5342ad2d3a207e980ec1fcf7e2de99 --- resources/main.js | 11 +++++++++++ skin.json | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/resources/main.js b/resources/main.js index e69de29..57ff859 100644 --- a/resources/main.js +++ b/resources/main.js @@ -0,0 +1,11 @@ +/** + * Timeless-specific scripts + */ +jQuery( function ( $ ) { + + /** + * Focus on search box when 'Tab' key is pressed once + */ + $( '#searchInput' ).attr( 'tabindex', $( document ).lastTabIndex() + 1 ); + +} ); diff --git a/skin.json b/skin.json index 29bf3e7..22120df 100644 --- a/skin.json +++ b/skin.json @@ -57,9 +57,12 @@ ] }, "skins.timeless.js": { - "targets": [ "desktop", "mobile" ], + "targets": [ "desktop" ], "scripts": [ "resources/main.js" + ], + "dependencies": [ + "jquery.tabIndex" ] }, "skins.timeless.mobile": {