From 3854a019d21853a0b83246d88b5ff94986e0d62b Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Thu, 13 Apr 2017 16:22:49 -0400 Subject: [PATCH] Focus active navigation item on popup. Fix #1049. --- omega-web/src/popup/js/keyboard.js | 5 +++++ omega-web/src/popup/js/profiles.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/omega-web/src/popup/js/keyboard.js b/omega-web/src/popup/js/keyboard.js index 2fa0c205..d180038e 100644 --- a/omega-web/src/popup/js/keyboard.js +++ b/omega-web/src/popup/js/keyboard.js @@ -48,6 +48,11 @@ handler(); } }); + + $script.ready('om-profile-items', function() { + var activeNavLink = document.querySelector('.om-nav-item.om-active > a'); + if (activeNavLink) activeNavLink.focus(); + }); } function tabbableElementsOnly(node) { diff --git a/omega-web/src/popup/js/profiles.js b/omega-web/src/popup/js/profiles.js index ef52f19f..752c8f0f 100644 --- a/omega-web/src/popup/js/profiles.js +++ b/omega-web/src/popup/js/profiles.js @@ -5,7 +5,7 @@ var profileTemplate = document.getElementById('js-profile-tpl') .cloneNode(true); - profileTemplate.classList.remove('om-profile-tpl'); + profileTemplate.removeAttribute('id'); var iconForProfileType = { 'DirectProfile': 'glyphicon-transfer', @@ -34,6 +34,7 @@ return; } addProfilesItems(state); + $script.done('om-profile-items'); updateOtherItems(state); }