akhodakivskiy / VimFx

Vim keyboard shortcuts for Firefox
https://addons.mozilla.org/firefox/addon/vimfx
Other
1.42k stars 175 forks source link

unable to click on few websites #1006

Open HexagonWin opened 3 months ago

HexagonWin commented 3 months ago

Hello. I'm not sure if this is actually something to report, but I'm having trouble clicking buttons using 'f' on a few websites. Most notably, the expandable menubar on this website gigglehd.com (website in korean) isn't working properly. Those three menu categories under the main "Gigglehd.com" logo (titled "기글하드웨어", "포럼", "커뮤니티") expands on mouse hover. I can make them expand using 'f', but clicking on one of the sub menu item immediately closes the menu instead of clicking it. Though, when I expand the menu using an actual mouse I can open the item just fine.

++This works fine on Vimium (the webextension)

girst commented 3 months ago

the problem appears to be that we somehow manage to trigger the onmouseout event handler (hiding the menu), and that our utils.simulateMouseEvents() can't handle clicking hidden elements.

when opening links in a new tab (F), i can get the link to open reliably. this code doesn't trigger utils.simulateMouseEvents.

i guess a quick fix would be to check if the element is indeed visible, or fall back to element.click() if it's not. such a change could be made in commands-frame.coffee::commands.click_marker_element. but i'm not sure what other consequences this might have.

thanks for reporting - let's see what i can come up with for a fix.

here's a minimal reproducer: load the page, hit f to show hints, then wait until the button is automatically hidden. then follow the hint.

<!DOCTYPE html>
<button id=b onclick="alert(1)">click</button>
<script>
window.setTimeout(function(){ b.style.display = "none"; }, 5000);
</script>