Selecting UI controls with keystrokes

I’ve recently been using (under duress) Windows for a project.
One thing it has that macOS doesn’t, or I haven’t found, is selecting Ok or Cancel (etc.) in dialog boxes using the arrow keys and Enter.
On macOS, one can usually select the ‘least bad’ button by pressing Enter, but to confirm an operation isn’t possible with keys.
It takes a lot of motion to reach for the mouse just to click a button, then reach back and align fingers on the home row.

Is there a way to use the keyboard to select different buttons on dialog boxes in macOS?

KM can do this IF (and that’s a big if) you link the macro to the look of the button (click on image action)

You can then link the action to a keyboard shortcut, but you’d probably spend more time tinkering to get it right then you save from not moving the mouse

1 Like

Thanks for the reply @JKoopmans . Yes, that would be a lot of work!

Okay, I was just fooling around in Preferences | Keyboard | Shortcuts, and even though I had Use keyboard navigation... turned on, it was only moving between edit controls. I turned it off to see what was different (nothing), then when I turned it back on, Tab started moving between edit fields and buttons as it should.
So this may be solved.

3 Likes

The difference with Windows is also that a secondary interface element will be activated with space, while the default option is always activated with enter, no matter where keyboard navigation has landed.

1 Like

AFAICR I think the convention is (assuming you have ‘Use keyboard navigation…’ on):

  1. Space activates a control with a selection bubble around it (e.g. one you’ve tabbed to)
  2. Enter selects the control marked as the default (a prominent solid colour).
  3. Escape and sometimes cmd-. (full-stop) cancel the dialogue.
  4. Ctl-F7 toggles ‘Use keyboard navigation…’ on and off.

So, you use tab to get to a specific control — if it’s not the default you activate it with Space (while Enter activates the default). If it is the default then either Space or Enter will activate it.

E.g. in TextEdit, cmd-o, then tab to get to the Options control:

  • Space will toggle the options panel
  • Enter won’t do anything because there’s no default
  • Escape or cmd-. will cancel the dialogue. (Cmd-. is really useful on iOS with an external keyboard without an Escape key…)
  • Once you’ve selected a file, Open becomes available and Enter will activate it.

In some dialogues (e.g. the Get Info panel in Music):

  • cmd-n, cmd-p or cmd-] / [ will take you to the next / previous song in the list without closing the dialogue
  • shift-cmd [ / ] will move you to the next/previous panel in the dialogue (e.g. from Details to Artwork). This also works to take you to back the main System Preferences dialogue when you’re in a specific pane.

If you tab to a radio button (or a pane selector like the one on the left of System Preferences > Dock & Menu Bar), then the arrow keys will move between the options and Space will select.

Finally, to save endless tabbing to get to the last option in the list, you can shift-tab at the top and it will take you straight to the last control in the dialogue.

Is that of any use?

4 Likes