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

RESOLVED FIXED in Firefox 25

Status

()

Firefox
Developer Tools: Inspector
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: harth, Assigned: bgrins)

Tracking

(Blocks: 1 bug)

unspecified
Firefox 25
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [landed-in-fxteam])

Attachments

(1 attachment, 4 obsolete attachments)

(Reporter)

Description

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.
(Reporter)

Updated

4 years ago
Duplicate of this bug: 892180
Blocks: 892157
(Assignee)

Updated

4 years ago
Assignee: nobody → bgrinstead
(Assignee)

Comment 2

4 years ago
Created attachment 783905 [details] [diff] [review]
bug-891556-1.patch
Flags: needinfo?(fayearthur)

Updated

4 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 3

4 years ago
Created attachment 784059 [details] [diff] [review]
bug-891556-2.patch

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?
(Assignee)

Comment 4

4 years ago
Created attachment 784535 [details] [diff] [review]
bug-891556-3.patch

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)
(Assignee)

Comment 5

4 years ago
Created attachment 785086 [details] [diff] [review]
bug-891556-4.patch

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]
bug-891556-4.patch

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+
(Assignee)

Comment 7

4 years ago
Created attachment 785109 [details] [diff] [review]
bug-891556-5.patch

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

Comment 8

4 years ago
Joe,
Can you push this to try?
Flags: needinfo?(jwalker)
https://tbpl.mozilla.org/?tree=Fx-Team&rev=79edca22de3f
https://hg.mozilla.org/integration/fx-team/rev/9e0f2aef72e3
Flags: needinfo?(jwalker)
Whiteboard: [landed-in-fxteam]
https://hg.mozilla.org/mozilla-central/rev/9e0f2aef72e3
Status: ASSIGNED → RESOLVED
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.

Sebastian

[1] http://code.google.com/p/fbug/issues/detail?id=6957
Any tips, how Firebug can simply override the default Ctrl+Shift+C shortcut?

Honza

Comment 13

3 years ago
Any thoughts on this access key changed?
http://hg.mozilla.org/mozilla-central/diff/9e0f2aef72e3/browser/locales/en-US/chrome/browser/devtools/inspector.properties
http://transvision.mozfr.org/string/?entity=browser/chrome/browser/devtools/inspector.properties:inspector.commandkey&repo=central
You need to log in before you can comment on or make changes to this bug.