If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Add Option+Cmd+U as an alternate keyboard shortcut for "View Source" on macOS like Safari and Chrome

RESOLVED FIXED in Firefox 57

Status

()

Core
Keyboard: Navigation
RESOLVED FIXED
14 days ago
12 days ago

People

(Reporter: cpeterson, Assigned: cpeterson)

Tracking

51 Branch
mozilla57
x86_64
Mac OS X
Points:
---

Firefox Tracking Flags

(firefox-esr52 wontfix, firefox55 wontfix, firefox56 wontfix, firefox57 fixed)

Details

(Whiteboard: parity-chrome,parity-safari)

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Assignee)

Description

14 days ago
We should add Option+Cmd+U as an alternate keyboard shortcut for "View Source" on macOS so Safari and Chrome web developers don't need to retrain their muscle memory.

Chrome and IE/Edge on Windows: Ctrl+U
Firefox on Windows: Ctrl+U

Safari and Chrome on macOS: Option+Cmd+U
Firefox on macOS: Cmd+U

This keyboard shortcut alias was a feature request from Twitter:

https://twitter.com/justnorris/status/905377487722565632

Below are links to lists of Chrome's keyboard shortcuts. There are other keyboard shortcuts that differ between Firefox, Chrome, and Safari.

https://support.google.com/chrome/answer/157179?hl=en

https://developers.google.com/web/tools/chrome-devtools/shortcuts
Comment hidden (mozreview-request)
(Assignee)

Comment 2

14 days ago
Joe and Markus, I'm not sure who the appropriate reviewer should be. The keyboard shortcut for "View Source" falls into a limbo between DevTools, Mac widget, and UX. <:)
Flags: needinfo?(mstange)
I'd put the responsibility with browser frontend people.
As for this change, you have my approval from the Mac widget side, but I don't think my side is very relevant.
Flags: needinfo?(mstange)
Gijs, can you suggest an appropriate reviewer?
Flags: needinfo?(gijskruitbosch+bugs)

Updated

13 days ago
Attachment #8906877 - Flags: review?(jwalker) → review?(gijskruitbosch+bugs)

Comment 5

13 days ago
mozreview-review
Comment on attachment 8906877 [details]
Bug 1398988 - Add Option+Command+U as an alternate keyboard shortcut for "View Source" on macOS like Safari and Chrome.

https://reviewboard.mozilla.org/r/178610/#review183718

I think I can review this, given how old/browser-y view source is and the location of the code change. I'm sure Joe will yell at me if he disagrees. :-)

This is effectively an r+ for making this change. However, we really need to use a separate key l10n string. There should probably also be a localization comment next to the string pointing to this bug and explaining why we have a second string (ie safari/chrome parity), so that other locales can, uh, actually do the same thing as French/Chinese/Canadian Safari/Chrome localizations (whatever that is - I'm not actually sure!). I'm erring on the side of clearing review rather than r+ mostly because it's so annoying to re-request review with mozreview if you wanted to do that. I promise a speedy r+ for an updated version that addresses the comments.

::: browser/base/content/browser-sets.inc:290
(Diff revision 1)
>      <key key="&reloadCmd.commandkey;" command="Browser:Reload" modifiers="accel" id="key_reload"/>
>      <key key="&reloadCmd.commandkey;" command="Browser:ReloadSkipCache" modifiers="accel,shift"/>
>      <key id="key_viewSource" key="&pageSourceCmd.commandkey;" command="View:PageSource" modifiers="accel"/>
> +#ifdef XP_MACOSX
> +    <!-- Also support Option+Cmd+U as alternate keyboard shortcut for "View Source" on macOS like Safari and Chrome. -->
> +    <key id="key_viewSource2" key="&pageSourceCmd.commandkey;" command="View:PageSource" modifiers="accel,alt"/>

Please duplicate the key l10n id, probably naming it something like "pageSourceCmd.macCommandKey" (based on the others in that style), and use that. We can't assume that locales other than English can reuse the same key for both the cmd-<foo> and cmd-alt-<foo> switch.
Attachment #8906877 - Flags: review?(gijskruitbosch+bugs)

Updated

13 days ago
Flags: needinfo?(gijskruitbosch+bugs)
(Assignee)

Comment 6

12 days ago
(In reply to :Gijs from comment #5)
> Please duplicate the key l10n id, probably naming it something like
> "pageSourceCmd.macCommandKey" (based on the others in that style), and use
> that. We can't assume that locales other than English can reuse the same key
> for both the cmd-<foo> and cmd-alt-<foo> switch.

Thanks, Gijs! I forgot that other locales might use different letters for their keyboard shortcuts. I added a localization comment and changed the `key_viewSource2` name to the more descriptive `key_viewSourceSafari`. This new patch is much nicer. :)
Comment hidden (mozreview-request)

Comment 8

12 days ago
mozreview-review
Comment on attachment 8906877 [details]
Bug 1398988 - Add Option+Command+U as an alternate keyboard shortcut for "View Source" on macOS like Safari and Chrome.

https://reviewboard.mozilla.org/r/178610/#review184250

LGTM, thanks!
Attachment #8906877 - Flags: review?(gijskruitbosch+bugs) → review+

Comment 9

12 days ago
Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8b15b56420ad
Add Option+Command+U as an alternate keyboard shortcut for "View Source" on macOS like Safari and Chrome. r=Gijs

Comment 10

12 days ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/8b15b56420ad
Status: NEW → RESOLVED
Last Resolved: 12 days ago
status-firefox57: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.