Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Unified Diff: ui/webui/resources/js/action_link.js

Issue 2768673002: [WebUI] Modify action-link's .no-outline on input only.
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/webui/resources/html/action_link_css.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/action_link.js
diff --git a/ui/webui/resources/js/action_link.js b/ui/webui/resources/js/action_link.js
index 9d83ed727a749c6549186c6b12f6d46ce2448ce7..e5a991821bfc93ceb3d56b343b6bf92cc0971f91 100644
--- a/ui/webui/resources/js/action_link.js
+++ b/ui/webui/resources/js/action_link.js
@@ -54,6 +54,12 @@ var ActionLink = document.registerElement('action-link', {
}
});
+ this.addEventListener('keyup', function(e) {
+ // If focus started via Tab press, allow outline to show.
+ if (e.key === 'Tab')
Dan Beam 2017/03/22 03:28:53 this isn't the only way focus can get to an elemen
+ this.classList.remove('no-outline');
+ });
+
function preventDefault(e) {
e.preventDefault();
}
@@ -70,16 +76,10 @@ var ActionLink = document.registerElement('action-link', {
document.addEventListener('selectstart', preventDefault);
document.addEventListener('mouseup', removePreventDefault);
- // If focus started via mouse press, don't show an outline.
+ // If focus started via mouse press, suppress outline.
if (document.activeElement != this)
this.classList.add('no-outline');
});
-
- this.addEventListener('blur', function(e) {
- // This check helps us exclude external events like application switch.
- if (e.sourceCapabilities)
- this.classList.remove('no-outline');
- });
},
/** @type {boolean} */
« no previous file with comments | « ui/webui/resources/html/action_link_css.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698