Open Bug 736990 Opened 12 years ago Updated 2 years ago

Find operation breaks CTRL+A (jump to start of line) within text fields

Categories

(Firefox :: Keyboard Navigation, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: spamcop, Unassigned)

Details

=== Steps to reproduce:
1. Open any page with a text field, e.g.
http://www.tizag.com/htmlT/htmltextarea.php
2. Make sure there is some text in the text field.
3. Start a "Find" by hitting CMD+F, focus changes to search field
4. Type something into the search field, any text will do.
4. Click into the text field at the end of the text, focus changes to it.
5. Hit CTRL+A

=== Expected Result:
The cursor is placed at the beginning of the current line within the text area. Apple applications support CTRL+A and CTRL+E to focus begin and end of line, just like most people are used from terminal and many command line file editors.

=== Actual Result:
"Highlight all" is enabled.

=== Additional Information:
CTRL in combination with any other key and without any other modifier should never trigger a default UI operation within an application on OS X in general. All UI operations are performed with the CMD key. Combinations of CMD+CTRL are allowed, just like CMD can be combined with ALT or SHIFT or any other combination of modifiers keys. CTRL+<key> should only perform a UI operation if the user himself configured it, e.g. in preferences that allow him to set his own keyboard shortcuts for app functionality. 

The only known exception to this rule is Xcode as far as I can tell, where certain CTRL combinations are possible for text editing functionality, however Apple made sure that none of the default combinations (like CTRL+A/E) are overridden and thus these combinations still work as expected within Xcode.
I can confirm this behavior for Firefox 21.0 and OS X 10.8.4, and also add a bit more detail.

As the reporter suggested, the mere presence of the Find bar in the browser window seems to trigger this misbehavior.  After a discussion with some helpful #firefox denizens I found that dismissing the Find bar with ESC before attempting to move the point with C-a is an effective (if inconvenient) workaround

I also found that when the Find bar is present, C-a toggles highlighting in the browser window of whatever the current search string happens to be, i.e. apparently it's equivalent to clicking the `Highlight all' button in the Find bar.  However, I couldn't chase this any further because I didn't see any obviously-related knobs in about:config, and I'm not aware of a way to ask Firefox, "What identifiable piece of code is the target of this key binding [or other GUI element] in this context?" similar to Emacs' describe-key function (C-h k) -- does that functionality exist, by the way?

Lastly, the OS X key binding convention the reporter mentioned is commonly known as the "Cocoa Text System", which is documented at https://developer.apple.com/library/mac/#documentation/TextFonts/Conceptual/CocoaTextArchitecture .  A good summary of its default bindings is available at http://www.hcs.harvard.edu/~jrus/Site/System%20Bindings.html .
Does this still happen on Mac?
Flags: needinfo?(wolruf)
Flags: needinfo?(spamcop)
Yes, it does still happen (Firefox 23.0.1).

IMHO CTRL+<Anything> should never trigger UI actions on OS X. 
To quote directly from Apple's "OS X Human Interface Guidelines":

As much as possible, use the Command key as the main modifier key in a keyboard shortcut. For example, Command-P uses Command to modify the P key. For a command that complements another more common command, you can add Shift to the shortcut. For example, the shortcut for the complementary Page Setup command adds Shift to the shortcut for Print to give Command-Shift-P. [...] If there’s a third, less common command that’s related to a pair of commands that use Command and Command-Shift, you can use Command-Option for the third command’s keyboard equivalent. Use combinations like these very rarely. Also use Option for a keyboard shortcut that is a convenience or power-user feature. For example, the Finder uses Command-Option-W for Close All Windows and Command-Option-M for Minimize All Windows. Because the Control key is already used by some of the universal access features as well as in Cocoa text fields where Emacs-style key bindings are often used, it should be used as a modifier key only when necessary.

So if you have to use CTRL on Mac, I would only use it in combination with CMD (CMD+CTRL+...). Every shortcut combination that does not involve CMD is either reserved for user shortcuts (e.g. Shortcuts for special system actions, like triggering Spotlight Search) or for very special system functions (e.g. as written above, many universal access features use CTRL only shortcuts by default).
Flags: needinfo?(spamcop)
Flags: needinfo?(wolruf)
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.