Add Ctrl-Shift-C (Cmd-Opt-C) shortcut to toggle highlighting

RESOLVED FIXED in Firefox 25



Developer Tools: Inspector
4 years ago
3 years ago


(Reporter: harth, Assigned: bgrins)


(Blocks: 1 bug)

Firefox 25
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [landed-in-fxteam])


(1 attachment, 4 obsolete attachments)



4 years ago
Currently we don't have a shortcut to toggle the highlighter. We need this. Chrome uses Ctrl-Shift-C (Cmd-Opt-C), and it's available in Mac/Win at least.

If the toolbox is open, this will switch to the Inspector tab and start the highlighter. If the toolbox is closed, it will open the devtools window with the Inspector tab selected and start highlighting. If the inspector tab is already open, this will just start highlighting. And if the highlighter happens to be on, this will stop highlighting.


4 years ago
Duplicate of this bug: 892180
Blocks: 892157


4 years ago
Assignee: nobody → bgrinstead

Comment 2

4 years ago
Created attachment 783905 [details] [diff] [review]
Flags: needinfo?(fayearthur)


4 years ago

Comment 3

4 years ago
Created attachment 784059 [details] [diff] [review]

Version that works, except for when devtools is undocked and you are focused on the web
Attachment #783905 - Attachment is obsolete: true
Attachment #784059 - Flags: feedback?

Comment 4

4 years ago
Created attachment 784535 [details] [diff] [review]

This patch implements the cmd+alt+c keyboard shortcut for toggling highlighting, and fixes another issue that happened when devtools were undocked *and* focused - keyboard shortcuts would not fire in the same way.  This is because _addKeysToWindow (toolbox.js) was actually running different logic than selectToolCommand (gDevTools.jsm).  Rather than trying to figure out a way to pass gBrowser to selectToolCommand from toolbox.js (which is not possible AFAIK), I implemented a fireCustomKey instance method  on the toolbox.  This way at least some of the logic can be shared between gDevTools and toolbox.  It will take a while to work out how to properly test this, so this patch is still a WIP.
Attachment #784059 - Attachment is obsolete: true
Attachment #784059 - Flags: feedback?
Flags: needinfo?(fayearthur)

Comment 5

4 years ago
Created attachment 785086 [details] [diff] [review]

Adds a basic keybinding test for the panels.  The behavior is such that on inspector, pressing ctrl+shift+c/cmd+alt+c will always switch to inspector tab and toggle highlighter.  For the other panels, they will continue to switch to their tab if not already selected, or close devtools otherwise.  The behavior for other tabs is different when devtools in undocked, since it will never close the window.  For inspector, the behavior is the same when docked and undocked.  Had to work around a situation where the keyboard shortcut for inspector did not work when the devtools window was focused (_addKeysToWindow had to be modified to fix this).
Attachment #784535 - Attachment is obsolete: true
Attachment #785086 - Flags: review?(jwalker)
Comment on attachment 785086 [details] [diff] [review]

Review of attachment 785086 [details] [diff] [review]:

::: browser/devtools/framework/gDevTools.jsm
@@ +349,3 @@
>      if (toolbox && toolbox.currentToolId == toolId) {
> +      let customKeyHandled = toolbox.fireCustomKey(toolId);

As discussed, we can probably find a more obvious solution than this, perhaps using a property to indicate how the tool wants to handle toggling.

::: browser/devtools/framework/toolbox.js
@@ +285,5 @@
> +
> +    if (activeToolDefinition.onkey && this.currentToolId === toolId) {
> +        activeToolDefinition.onkey(this.getCurrentPanel());
> +        return true;
> +    }

I know that undefined==false, but I still think it makes sense to 'return false;' here in case anyone assumes a boolean.
Attachment #785086 - Flags: review?(jwalker) → review+

Comment 7

4 years ago
Created attachment 785109 [details] [diff] [review]

Fixes minor issues from previous patch
Attachment #785086 - Attachment is obsolete: true

Comment 8

4 years ago
Can you push this to try?
Flags: needinfo?(jwalker)
Flags: needinfo?(jwalker)
Whiteboard: [landed-in-fxteam]
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 25
Depends on: 907891
Blocks: 934088
FYI this new shortcut conflicts with Firebug.[1]

> Currently we don't have a shortcut to toggle the highlighter.
Actually you already had Ctrl+Shift+I for it since you introduced the inspector.


Any tips, how Firebug can simply override the default Ctrl+Shift+C shortcut?


Comment 13

3 years ago
Any thoughts on this access key changed?
You need to log in before you can comment on or make changes to this bug.