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

Firefox Nightly changes uBlock Origin extension shortcut on restart #836

Closed
8 tasks done
vurtomatic opened this issue Jan 2, 2020 · 16 comments
Closed
8 tasks done
Labels
external issue involving an external factor Firefox specific to Firefox invalid not a uBlock issue

Comments

@vurtomatic
Copy link

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

I set CTRL+A as the extension keyboard shortcut for uBlock Origin's "Relax blocking mode".

A specific URL where the issue occurs

https://www.reddit.com/r/firefox/comments/eit67e/firefox_nightly_mac_extension_keyboard_shortcut/

Steps to Reproduce

  1. Press CTRL+A to relax blocking mode
  2. Nothing happens
  3. Check about:addons > Manage Extension Shortcuts
  4. See that the shortcut is changed to CMD+A

Expected behavior:

CTRL+A should trigger Relax blocking mode.

Actual behavior:

Nothing happens because it's mysteriously changed to CMD+A. This happens on every restart of Firefox Nightly.

Your environment

  • uBlock Origin version: 1.24.2
  • Browser Name and version: 73.0a1 (2020-01-01) (64-bit)
  • Operating System and version: Mac OS 10.14.6 (18G1012)
@uBlock-user
Copy link
Contributor

Because it's Command on Mac OS instead of CTRL key , -- gorhill/uBlock#614

Isn't that so ?

@uBlock-user uBlock-user added the something to address something to address label Jan 2, 2020
@gorhill
Copy link
Member

gorhill commented Jan 2, 2020

I set CTRL+A as the extension keyboard shortcut

How did you do this?

@vurtomatic
Copy link
Author

vurtomatic commented Jan 2, 2020

I set CTRL+A as the extension keyboard shortcut

How did you do this?

Hi @gorhill , I set it from the about:addons, by clicking on the gear icon on the right and choosing Manage Extension Shortcuts:

Screen Shot 2020-01-02 at 8 50 15 AM

You can see in this current screenshot, Firefox Nightly always defaults the CTRL to CMD after a restart:

Screen Shot 2020-01-02 at 8 51 24 AM

However, uBlock Origin does register it as CTRL+A:

Screen Shot 2020-01-02 at 8 53 02 AM

@gorhill
Copy link
Member

gorhill commented Jan 2, 2020

uBO's own shortcut UI is unreliable on MacOS, there is an open issue about this, which really I should close because that UI exists only as a crutch for when there was no Firefox UI to set the shortcut.

Now that there is a Firefox UI to set shortcut, use it, and if ever you find that it does not function according to your expectations, open a Firefox issue about it.

@vurtomatic
Copy link
Author

I actually set the shortcut with the Firefox interface, never did it with uBlock Origin. It looks like uBlock Origin is functioning more correctly than Firefox since it does register the shortcut!

I'll open the Firefox issue. I did think it was a Firefox problem but when I initially posted it on /r/Firefox, they suggested I open an issue here. Thanks @gorhill !

@gorhill
Copy link
Member

gorhill commented Jan 2, 2020

I linked to the wrong uBO issue above, this is the right one: #628. uBO's own UI is not able to input Mac command key-based shortcuts, see #106 (comment). But as said, shortcuts entered using Firefox's own UI should work, uBO does not handle or even care about what the shortcuts are, it just register a listener to be called when Firefox detects that the shortcut has been triggered.

@vurtomatic
Copy link
Author

Hmmm interesting that Firefox can't allow CMD as custom shortcut modifier. However, CMD+A which "Selects All" on a page, does work within Firefox; but this is probably an OS-level shortcut that Firefox is simply respecting.

I'm trying to set CTRL as the modifier though, so perhaps this is the culprit that #106 mentions:

Press 'control' which able to record shortcut, but unable to call. (Because Mac treat 'Ctrl' as 'Command')

I never knew that but that would explain why Firefox keeps saving CTRL+A as CMD+A.

I've opened an issue at Firefox here.

@gorhill
Copy link
Member

gorhill commented Jan 2, 2020

probably an OS-level shortcut that Firefox is simply respecting.

Right, if I try to enter ctrl-a as shortcut in Firefox UI, it's being refused with the error message "Can't override a Nightly shortcut".

Probably uBO is displaying Command as Ctrl in it's own UI, so I wouldn't rely on uBO's UI for MacOS. The main reason why that UI is being kept alive is because Firefox's UI still does not allow the removal of a shortcut, something uBO can do.

@uBlock-user uBlock-user added external issue involving an external factor Firefox specific to Firefox and removed something to address something to address labels Jan 2, 2020
@vurtomatic
Copy link
Author

Hi @gorhill , were you able to replicate this? Someone over at Firefox looked at the issue and is saying they can't replicate it.

@vurtomatic vurtomatic reopened this Jan 8, 2020
@gorhill
Copy link
Member

gorhill commented Jan 8, 2020

I don't have a MacOS computer, it's not possible for me to try to replicate.

@vurtomatic
Copy link
Author

Ok. They might have some insight over at Firefox, this was the question posed:

I was also unable to reproduce this initially. After checking out the uBlock Origin Shortcuts UI though I wonder if the bug is in the extension.

When setting a shortcut to Ctrl+A in about:addons I see ^A there, and MacCtrl+A in the uBlock Origin Shortcuts UI. This looks right to me, the webextensions API maps Ctrl to Cmd on Mac (this is the expected behaviour) so to get Ctrl you use MacCtrl on Mac.

When setting the shortcut in the uBlock Origin Shortcuts UI pressing Ctrl+A shows Ctrl+A there and ⌘A in about:addons.

Which UI are you setting the shortcut in?

I wonder if there're some "signals" getting mixed in there.

@vurtomatic
Copy link
Author

Further troubleshooting: By setting CTRL+A in Firefox UI and NOT OPENING uBlock UI ever, the shortcut persists between restarts.

So I'm thinking, somehow, after setting it in Firefox (which actually registers CTRL as MacCtrl), opening uBlock UI, uBlock displays it as CTRL and somehow, that gets parsed back to Firefox as CTRL who then misinterprets it as CMD.

I think you mentioned uBlock's UI doesn't actually do anything with shortcuts and is only reading what's set with Firefox UI, but somehow uBlock displaying it seems to be affecting how Firefox registers the shortcut.

It's the only theory I have to explain this odd behavior I described above.

@vurtomatic
Copy link
Author

Hi @gorhill : So after some discussion over at Firefox, we're thinking this might be a uBlock issue because it's registering CTRL as CTRL instead of MacCtrl because Firefox interprets CTRL as CMD.

Confusing as hell.

Looks like this was mostly some confusion between the two places to set the shortcut.

Setting a shortcut to Ctrl+Y in the uBlock Origin interface actually binds it to Cmd+Y so this is a bug in their implementation. I don't think it's accounting for how Mac shortcuts are set. You could file an issue on their tracker [1]. I looked for a duplicate but only found an issue about dropping their UI when we add support for removing shortcuts.

https://bugzilla.mozilla.org/show_bug.cgi?id=1606683#c6

@gorhill
Copy link
Member

gorhill commented Jan 8, 2020

Why are you using uBO's UI to set shortcuts? I said above that it's unreliable on MacOS and that you should be using Firefox's built-in UI for setting shortcuts.

@vurtomatic
Copy link
Author

vurtomatic commented Jan 8, 2020

I'm not, that was someone else's understanding of the issue.

So far what I mentioned in this comment is what's happening.

Since setting the shortcut in Firefox, the shortcut has been fine as long as I don't open uBlock's UI. I don't have a logical explanation for what I've observed.

@vurtomatic
Copy link
Author

vurtomatic commented Jan 9, 2020

Ok I think we can finally resolve this, sorry for all the back and forth.

Ctrl+A set in Firefox UI, will appear as MacCtrl+A in uBlock UI:

Screen Shot 2020-01-09 at 5 19 32 AM

At some point when I was troubleshooting before opening this issue, I must've entered Ctrl+A into uBlock's UI and since then, it had persisted as Ctrl+A within uBlock which Firefox interprets as Cmd+A, DESPITE entering Ctrl+A into Firefox later.

So that's user error on my part for entering CTRL+A with uBlock. The odd behavior is subsequent entering of CTRL+A into Firefox did not change CTRL+A to MacCtrl+A in uBlock, uBlock kept it as Ctrl+A which Firefox converts to Cmd+A every restart.

While troubleshooting, I wiped all the keyboard shortcuts and only set it within Firefox. This seems to work as you said now.

SUGGESTION:

  • Within uBlock's UI for shortcut, don't make the fields editable, only display the keyboard shortcuts.
  • Have instruction directing user to Firefox' UI for extension shortcuts.
  • Within uBlock's shortcut UI, correctly display Ctrl as Ctrl instead of MacCtrl for users who are unaware of this conversion?

@uBlock-user uBlock-user added the invalid not a uBlock issue label Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external issue involving an external factor Firefox specific to Firefox invalid not a uBlock issue
Projects
None yet
Development

No branches or pull requests

3 participants