ampie icon indicating copy to clipboard operation
ampie copied to clipboard

firefox: Alt key is a default menu binding, causes glitches

Open karlicoss opened this issue 4 years ago • 10 comments

https://support.mozilla.org/en-US/questions/1278533

Unlike in Chrome, the Firefox add-on persists the tooltips when holding alt + in addition this switches the menu on/off (might be annoying for some people).

Let me know if you can't reproduce, I can record a video! I'm on Ubuntu, in case it matters.

karlicoss avatar Nov 21 '20 08:11 karlicoss

You mean when letting go of Alt the popups still stay? Maybe because the menu that appears steals the keyboard focus and the keyup event for Alt is not fired. Could you check if the blur event for a document is fired after pressing alt? I guess I might have to offer a choice between {Alt, Ctrl}+(Shift)?, would holding down Ctrl be problematic? What about Meta?

posobin avatar Nov 21 '20 15:11 posobin

You mean when letting go of Alt the popups still stay?

Yep! I think the more annoying thing however is that it toggles the menu, which shifts the whole page down, so might discourage people from using it.

Tried this:

document.addEventListener('blur' , () => console.error("BLUR"));
document.addEventListener('focus', () => console.error("FOCUS"));

However pressing Alt doesn't trigger either of these. I'd imagine it's more of OS-level stuff.. I'd be surprised if you'd manage to bind Shift; Meta might work, but it also might conflict with the global menu key for some people. It's sad it's so complicated, but adding some sort of setting for this might be the best option :(

karlicoss avatar Nov 21 '20 16:11 karlicoss

Also, just realized, I have some other Alt bindings (e.g. Alt+j/k), and they work fine without causing the menu to toggle. In fact, I can press any non-existing Alt binding (e.g. Alt-F), and it causes Ampie to pop up without showing the window menu!

karlicoss avatar Nov 21 '20 19:11 karlicoss

I added the ability to switch to meta/ctrl/shift or disable it completely in the settings (you need to click the ampie icon in the extensions toolbar to open it). Does it work for you?

posobin avatar Nov 25 '20 08:11 posobin

Uhoh, it's not loading, just all white (was working before!) :( image

Oddly, I can't run devtools against it, but in the background page there are a bunch of warnings, perhaps they are relevant

09:22:40.125 The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol. popup.html
09:22:40.149
sendRemoveListener on closed conduit {4ca7b2f4-ff6f-4599-a39b-9f776f3e8ba6}.1374390572883 ConduitsChild.jsm:108
09:22:40.150
Promise resolved after context unloaded
popup-page.js:1545
09:22:40.151
Promise resolved after context unloaded
popup-page.js:1418
09:23:23.005
Unchecked lastError value: Error: Could not establish connection. Receiving end does not exist. background.js:1

karlicoss avatar Nov 26 '20 09:11 karlicoss

Very weird, does this stay after you restart the browser? The messages look like the extension was unloaded after the popup page was opened, or the popup is running a different version of the source somehow.

posobin avatar Nov 26 '20 17:11 posobin

I took my old linux laptop out and can't reproduce this on firefox.

posobin avatar Nov 26 '20 18:11 posobin

Huh, indeed, after restart it works fine, thanks! Yeah, I also remember now I had some issues with my extension after update unless I restarted. I think there is some extension lifecycle method one can listen on, but don't remember exactly.

karlicoss avatar Nov 26 '20 18:11 karlicoss

Hmm interesting, happened again after I briefly turned extension off and then back on. I'll see if I can consistently reproduce.

karlicoss avatar Nov 26 '20 19:11 karlicoss

P.S. oh sorry, and back to the original issue -- the hotkey selection works, thanks! I'll try Shift in the meantime, hopefully it won't conflict with anything.

karlicoss avatar Nov 26 '20 21:11 karlicoss