Skip to content

Commit

Permalink
Fix clickable elements with class 'btn'
Browse files Browse the repository at this point in the history
Fixes philc#3550

Update `content_scripts/link_hints.js` to make elements with class 'btn' clickable.

* Add logic to `getLocalHintsForElement` to check for class 'btn' and mark elements as clickable.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/philc/vimium/issues/3550?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
ScottWilliamAnderson committed Oct 29, 2024
1 parent 654edf2 commit 4656c1c
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions content_scripts/link_hints.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
//
// This implements link hinting. Typing "F" will enter link-hinting mode, where all clickable items
// on the page have a hint marker displayed containing a sequence of letters. Typing those letters
// will select a link.
//
// In our 'default' mode, the characters we use to show link hints are a user-configurable option.
// By default they're the home row. The CSS which is used on the link hints is also a configurable
// option.
//
// In 'filter' mode, our link hints are numbers, and the user can narrow down the range of
// possibilities by typing the text of the link itself.
//

// A DOM element that sits on top of a link, showing the key the user should type to select the
// link.
class HintMarker {
hintDescriptor;
localHint;
Expand Down Expand Up @@ -1222,6 +1207,12 @@ const LocalHints = {
onlyHasTabIndex = true;
}

// Check for elements with class 'btn'
if (!isClickable && className?.toLowerCase().includes("btn")) {
isClickable = true;
possibleFalsePositive = true;
}

if (isClickable) {
// An image map has multiple clickable areas, and so can represent multiple LocalHints.
if (imageMapAreas.length > 0) {
Expand Down

0 comments on commit 4656c1c

Please sign in to comment.