Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support hints for hovering an element/link #48

Open
trygveaa opened this issue Feb 13, 2022 · 2 comments
Open

Support hints for hovering an element/link #48

trygveaa opened this issue Feb 13, 2022 · 2 comments

Comments

@trygveaa
Copy link

Problem

Some web pages have a menu where you need to hover the menu item to see a sub menu. It would be great if link hints could make the item hovered when clicked to open such menus. On some pages the menu item itself links to a page, so a different key would be necessary to distinguish between opening the menu and clicking the link.

Probably easier explained with some examples.

https://www.osloklatresenter.no/ (sorry, Norwegian site, but the text shouldn't matter)
Here I get hints for the menu items, but when activating them nothing happens since the sub menus don't stay open if you click on the menu item and move the mouse away. You have to keep hovering the menu item or sub menu to keep it open.

https://www.engadget.com/
Here the sub menu actually opens when I activate the hint, but since the menu items are also links it navigates to the new page right away.

Suggestion

To fix the first one, it would be great if the hints hovered the element in addition to clicking it.

To fix the second one, I think a new shortcut to only hover an element and not click it would be necessary.

Debug info

Debug info
{
  "version": "1.2.0",
  "browser": "chrome",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36",
  "platformInfo": {
    "arch": "x86-64",
    "nacl_arch": "x86-64",
    "os": "linux"
  },
  "storage.sync": {
    "css": ".root {\n  font-family: Helvetica, Arial, sans-serif;\n}\n\n.hint {\n  font-size: 11px;\n  padding: 1px 3px 0px 3px;\n  color: #302505;\n  background-image: linear-gradient(to bottom, #fff785, #ffc542);\n  border: 1px solid #c38a22;\n  border-radius: 3px;\n  box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.3);\n  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);\n  font-weight: bold;\n}\n\n.highlighted {\n  filter: hue-rotate(45deg) saturate(150%);\n}\n\n.matchedChars {\n  opacity: 1;\n  color: #d4ac3a;\n}\n\n.status {\n  font-size: 12px;\n  padding: 3px 3px 2px 3px;\n  color: black;\n  background-color: #ebebeb;\n  border: 1px solid #b3b3b3;\n  border-radius: 4px 4px 0 0;\n  text-shadow: 0 1px 2px white;\n  min-width: 150px;\n  right: 150px;\n}",
    "normal.alt-S": "EnterHintsMode_BackgroundTab",
    "normal.alt-s": "EnterHintsMode_Click"
  },
  "storage.local": {
    "tutorialShown": true
  },
  "language": "en-GB",
  "layout": {
    "KeyE": "e",
    "KeyD": "d",
    "Minus": "-",
    "KeyH": "h",
    "KeyZ": "z",
    "Equal": "=",
    "KeyN": "n",
    "KeyP": "p",
    "BracketRight": "]",
    "BracketLeft": "[",
    "Digit8": "8",
    "Digit9": "9",
    "KeyS": "s",
    "Semicolon": ";",
    "Digit5": "5",
    "KeyQ": "q",
    "KeyO": "o",
    "Period": ".",
    "Digit6": "6",
    "KeyV": "v",
    "Digit3": "3",
    "KeyL": "l",
    "Backquote": "`",
    "KeyG": "g",
    "KeyJ": "j",
    "KeyT": "t",
    "Quote": "'",
    "KeyY": "y",
    "IntlBackslash": "\\",
    "KeyR": "r",
    "Backslash": "\\",
    "KeyU": "u",
    "KeyK": "k",
    "Slash": "/",
    "KeyF": "f",
    "KeyI": "i",
    "KeyX": "x",
    "KeyA": "a",
    "Digit2": "2",
    "Digit7": "7",
    "KeyM": "m",
    "Digit4": "4",
    "KeyW": "w",
    "Digit1": "1",
    "Digit0": "0",
    "KeyB": "b",
    "KeyC": "c",
    "Comma": ","
  }
}
@lydell
Copy link
Owner

lydell commented Feb 13, 2022

Hi! I have the same problem myself from time to time.

Unfortunately, many of these menus are built using CSS :hover which (as far as I know) cannot be triggered programmatically. (It was possible for legacy XUL Firefox extensions, because I built it for VimFx back in the day, but it isn’t possible with WebExtensions.)

It is possible to trigger events such as mouseover which could be enough on some sites, but I’m a bit reluctant to add even that because you’ll never know when the hover command works or not and it’ll feel broken.

One thing you can do is to contact the sites and ask them to improve the accessibility. It should be possible to access menus without using a mouse, such as via focus/keyboard. In an ideal world, all sites would fix their accessibility issues and Link Hints would not have to change at all. In reality it would be great if Link Hints could work better even on bad sites, but currently it looks like it’s not possible.

@trygveaa
Copy link
Author

Unfortunately, many of these menus are built using CSS :hover which (as far as I know) cannot be triggered programmatically. (It was possible for legacy XUL Firefox extensions, because I built it for VimFx back in the day, but it isn’t possible with WebExtensions.)

It is possible to trigger events such as mouseover which could be enough on some sites, but I’m a bit reluctant to add even that because you’ll never know when the hover command works or not and it’ll feel broken.

Ah, well, I can see that argument against adding a separate command for hovering, but I don't see that as a reason to not send mouseover when clicking a link. This would fix at least the first page here which currently gives hints for the menu items, but does nothing when activating them.

FWIW cVim both hovers when clicking a link, and also has a separate command for just hovering. Looking at the code, it looks like it sends mouseover like you said, and also mouseenter.

One thing you can do is to contact the sites and ask them to improve the accessibility. It should be possible to access menus without using a mouse, such as via focus/keyboard. In an ideal world, all sites would fix their accessibility issues and Link Hints would not have to change at all. In reality it would be great if Link Hints could work better even on bad sites, but currently it looks like it’s not possible.

Sure, I could, but contacting every site which does this would take some work, and I would have to wait for them to fix it (which in some cases would probably not happen).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants