From 95dfb4011f5f47e3f668311676267609e68a3d17 Mon Sep 17 00:00:00 2001 From: girst Date: Thu, 30 Jan 2020 23:05:33 +0100 Subject: [PATCH] Fix GitHub search box hint Github has wrapped the input field in a div with aria attributes, but the trigger is actually attached to the input itself. Since they share the same position, the useless hint for the div is displayed on top of the useful hint of the input. Minimal test case:
--- extension/lib/commands-frame.coffee | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/extension/lib/commands-frame.coffee b/extension/lib/commands-frame.coffee index 7ed9308..f4ff792 100644 --- a/extension/lib/commands-frame.coffee +++ b/extension/lib/commands-frame.coffee @@ -252,13 +252,15 @@ commands.follow = helper_follow.bind( when isTypingElement(element) type = 'text' when element.localName in ['a', 'button'] or - element.getAttribute?('role') in CLICKABLE_ARIA_ROLES or - # - element.hasAttribute?('aria-controls') or - element.hasAttribute?('aria-pressed') or - element.hasAttribute?('aria-checked') or - (element.hasAttribute?('aria-haspopup') and - element.getAttribute?('role') != 'menu') + (element.getAttribute?('role') in CLICKABLE_ARIA_ROLES or + # + element.hasAttribute?('aria-controls') or + element.hasAttribute?('aria-pressed') or + element.hasAttribute?('aria-checked') or + (element.hasAttribute?('aria-haspopup') and + element.getAttribute?('role') != 'menu')) and + (element.localName not in ['div', 'span'] or + utils.hasEventListeners(element, 'click')) type = 'clickable' when utils.isFocusable(element) and # Google Drive Documents. The hint for this element would cover the -- 2.39.3