-
Notifications
You must be signed in to change notification settings - Fork 56
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
Proposal: Improve the browser.commands API #300
Comments
+1 |
Another problem is that the format of But I found the shortcut string is not uniform across platforms. For example, on macOS, it is So I propose to unify and clearly define its format. |
This would be useful in some of products I work/worked on. Another consideration: MV2 has two commands called |
This would also be very nice. I believe that in some contexts some keyboard keys are named inconsistently in different browsers. I believe, at some point I saw |
@bershanskiy Because I don't care about the key, I only care about how to parse the shortcut string. I have another proposal for this problem, adding a new property in Command object like below:
Then I can use it to format shortcut in page, like this:
|
Is |
Welcome to support it in MV2 if possible. But given other similar situations and the current schedule, I don't think Chrome will support new feature in MV2. |
@hanguokai could still be supported in MV2 for Firefox and Safari. Tho maybe they already do as we did not test it yet? |
@hanguokai Can we split the "Unify and define the format of Command.shortcut string" into a separate issue for clarification? My first thoughts would be to use the key names as given by KeyboardEvent.key. |
@carlosjeurissen as my previous comment, this problem can be resolved by another way. And here, I don't mean the key string, I mean the format of key combination(e.g. key1+key2 or key1key2). |
@hanguokai You mentioned the key string is different across operating systems ( |
@carlosjeurissen Yes, welcome to add a new issue for that. |
And on Chrome, chrome also return "_execute_browser_action" in MV2. So for problem-1, this is a MV3 bug. |
I have updated my first post to reflect the feedback and new design(for problem-3). |
Complement another API proposal: Open Shortcut for editing.
I reported this feature request a year and a half ago at crbug-1173375. Why need this API?Take Chrome as an example, the shortcut page is |
Even greater reply
…On Mon, Oct 17, 2022 at 1:03 PM Jackie(Guokai) Han ***@***.***> wrote:
Related Doc Links: Chrome
<https://developer.chrome.com/docs/extensions/reference/commands/>, MDN
<https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/commands>
.
Use Case
Some extensions support lots of user defined keyboard shortcuts, so users
may forget some shortcuts. To help user check current shortcuts
quickly(read only), developers want to display a table of all current
shortcuts for users in the popup page or an extension page.
The lack of the API
The problem is that:
1. browser.commands.getAll() doesn't return the command of
"_execute_action" at present.
2. When the user changed a shortcut, there is no changed event for
extension to know it for updating the shortcuts table.
New API
1.
For "_execute_action", I suggest commands.getAll() including the
command of "_execute_action". Or add a new api for it.
2.
Add a new event to notify extensions the shortcuts has changed, like
below:
browser.commands.onRegistrationChanged.addListener( command => {} )
PS: I don't care about the api name or the details, as long as it meets
the functional requirements.
—
Reply to this email directly, view it on GitHub
<#300>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZF74ZL7TQQJJMRUBW2F63WDWPJFANCNFSM6AAAAAARHLOQPI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
@hanguokai Again it would help a lot if we create separate issues in the group for features which could be implemented separately. This allows vendors to indicate support for specific features individually and keep the issue thread understandable. Having the ability to open the keyboard shortcuts page would be great. It's a perfect subject for a new issue in the group. In which we can discuss how this would work in different browsers. |
@carlosjeurissen These functional requirements are all about |
@hanguokai during the 2022-10-27 discussion. It was brought up (not by me), it would be productive if we can split this issue up in separately discussable / implementable issues so we can discuss them in the next meeting. |
@carlosjeurissen I see the meeting note, it will be discussed in next meeting. This proposal contains a number of trivial but related little features. If you're very, very sure it needs to create 4 new issues, I'm willing to do so. Or wait until after the next meeting. |
While these feature requests may be related to you, they are essentially different feature requests. Having them all bundled together means that it would be impossible to use the github labels to express support/opposition to the individual feature requests. Therefore I recommend to split up the issue. On the specific proposals:
In short I think that it's only worthwhile to file follow-ups for 2 and 4. |
@Rob--W OK, I will create 3 new issues for 2-4. For proposal 3, you're missing my point. I don't mean the format of "suggested_key" in manifest. I mean the value of |
In Firefox the For next reports, please test in Firefox (and/or Safari), not just Chrome. That would make it easier to determine whether a bug is an implementation-specific bug or possibly a broader cross-browser issue. |
Let's continue the discussion in the individual issues. I copied over some recent threads at the end of this issue; if you felt that any prior discussion is unresolved and needs to be repeated in the new issues, just copy it there. I'm closing this issue to encourage the use of the new issues (#308 #309 #310). |
I reported a bug for it. At present, it has not been fixed. |
FYI: my original proposal-1 has fixed in Chrome. Since Chrome 110, chrome.commands.getAll() returns the Command of "_execute_action". Thanks @oliverdunk for fixing this bug. |
Note: I have updated this to reflect the feedback and new design.
Related Doc Links: Chrome, MDN. Tracking bugs: crbug-1375790 and crbug-1173375.
Use Case
Some extensions support lots of user defined keyboard shortcuts, so users may forget some shortcuts. To help user check current shortcuts quickly(read only), developers want to display a table of all current shortcuts for users in the popup page or an extension page.
Proposal 1: Return the command for "_execute_action"
At present,
commands.getAll()
doesn't return the command of "_execute_action" in MV3 (It returns in MV2).Proposal:
commands.getAll()
should return the command of "_execute_action".Proposal 2: New api: shortcut changed event
At present, when the user changed a shortcut, there is no changed event for extension to know it for updating the shortcuts table.
Proposal: Add a new event to notify extensions the shortcuts has changed, like below:
PS: I don't care about the api name or the details, as long as it meets the functional requirements.
Proposal 3: Unify the format of Command.shortcut (key combination) or add a new property shortcutKeys in Command
Another problem is that the format of
Command.shortcut
is not defined. Developers need to parse the shortcut string to styled display it. For example, if the shortcut string is"Ctrl + F"
, then use<kbd>Ctrl</kbd> + <kbd>F</kbd>
to display in web pages.But I found the shortcut string is not uniform across platforms on Chrome. For example, on macOS, it is
"^F"
(no plus sign and use ^ for Ctrl), but on ChromeOS, it is"Ctrl+F"
.So I propose to unify and clearly define its format or add a new property in Command object like below:
Then I can use it to format shortcut in page, like this:
Proposal 4: New API: Open Shortcut.
I reported this feature request a year and a half ago at crbug-1173375.
Why need this API?
Take Chrome as an example, the shortcut page is
chrome://extensions/shortcuts
, which centralizes all extensions' shortcuts settings. We need to let users locate to current extension (not other extensions) in this page. Assuming that the user has dozens of extensions installed, if we cannot directly locate to current extension, then the user will spend the effort to find this extension first. Assuming that if the extension supports 30 shortcuts, it is also necessary to directly locate to a specified shortcut (not other shortcuts) in this extension.The text was updated successfully, but these errors were encountered: