odebroqueville / contextSearch

Firefox add-on to search selected text in a web page using your favorite search engines from a context menu or from a grid of icons.
Other
19 stars 2 forks source link

Use global extension shortcut page #160

Closed HifeFish closed 7 months ago

HifeFish commented 7 months ago

Can the keyboard shortcuts of this addon be integrated into the global extension shortcut page? I found it quite difficult to delete conflicting custom shortcuts as, e.g. pressing backspace just makes "Backspace" the shortcut.

odebroqueville commented 7 months ago

I'm sorry but I don't understand what you mean by "the global extension shortcut page". Concerning the "Backspace" key, I think I can fix that so that it's never offered as a shortcut key for search engines. This way "Backspace" shouldn't appear in the input field for your search engine shortcuts. In the mean time, try selecting the shortcut text with the mouse cursor.

HifeFish commented 7 months ago

Thanks for the reply.

On the about:addons page, after clicking the gear on the top right, there is an option "manage extension keyboard shortcuts" (or similar). This opens a list of "all" (apparently not all) keyboard shortcuts used by extensions. That is the page I meant. A major advantage is that it detects and highlights conflicts with other add-ons. I am not entirely sure how this works with a variable number of shortcuts like Context Search uses.

odebroqueville commented 7 months ago

Thank you for clarifying. The addons shortcuts page you're referring to contains shortcuts that are defined in the manifest file (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands). Therefore, as you correctly mentioned, these shortcuts cannot contain a variable list or be defined dynamically. Furthermore, I think some users would be confused if part of the search engines' options were defined in the extension's Options page and the shortcuts would be listed in the addons shortcuts page. However, your suggestion is valid and helpful when it comes to letting users specify a shortcut to launch the Icons Grid. So, thank you for your input.

UPDATE: Please verify that you're using the latest version of Context Search (4.7.2), because you should be able to remove text using the 'Delete' or 'Backspace' keys with no issues. You should also be able to move in the input text box using the usual cursor keys.

HifeFish commented 7 months ago

Backspace and arrow keys now work on version 4.7.2. Thanks for the swift fix!

I agree that it can be confusing to have settings on different pages. Some add-ons, e.g. All Tabs Helper have their own mechanism to set keyboard shortcuts, but they also show up on the Manage Extension Shortcuts page. If you use their own mechanism, it doesn't detect conflicts though. For the Icons Grid shortcut, I think a good compromise could be a button on the settings page sending you to the relevant section of the Manage Extension Shortcuts page, if that is possible.

There is still some strange behaviour with the shortcuts, e.g.:

These are less of a problem, just some oddities I've noticed while playing around.

odebroqueville commented 7 months ago

Unfortunately, I'm only able to test on macOS and I don't think that there's an easy fix that takes into account all browser assigned keyboard shortcuts for all OS's. For example, Firefox on macOS doesn't have an Alt + f keyboard shortcut to open the file menu. However, I tested with Cmd + f which is used to find text. Selecting an input text field, then pressing Cmd + f, then the Escape key, then Alt + f generates the gibberish shortcut: "Cmd + Alt + ff"!!! This is because, for some unknown reason, the keyup event isn't fired when releasing Cmd + f! Crazy stuff! I could remove duplicates, but my recommendation would be to focus exclusively on the shortcut you're typing.

I found another glitch which bothered me more: not being able to mouse click inside the text in an input text field. I will release a bug fix for this in v4.7.3.