Discussion:
NSAlert
Richard Charles
2018-09-08 22:53:57 UTC
Permalink
I have a simple NSAlert presented as an attached sheet with a single default OK button.

When the spacebar is pressed the alert is dismissed.

It this a new thing?

Is this documented anywhere?

--Richard Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net
Andy Lee
2018-09-09 00:25:44 UTC
Permalink
I don't know where or whether it's documented, but it's not new.
Using Space for "clicking" whichever control has focus has been around
for a while. I don't remember offhand -- it may depend on the setting
in System Preferences that governs whether all controls can get
keyboard focus.
--Andy
Post by Richard Charles
I have a simple NSAlert presented as an attached sheet with a single default OK button.
When the spacebar is pressed the alert is dismissed.
It this a new thing?
Is this documented anywhere?
--Richard Charles
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net
Alex Zavatone
2018-09-09 00:52:31 UTC
Permalink
Which version of macOS are you running?

Sent from my iPhone
Post by Richard Charles
I have a simple NSAlert presented as an attached sheet with a single default OK button.
When the spacebar is pressed the alert is dismissed.
It this a new thing?
Is this documented anywhere?
--Richard Charles
_______________________________________________
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net
Richard Charles
2018-09-10 18:06:06 UTC
Permalink
Post by Andy Lee
I don't know where or whether it's documented, but it's not new.
Using Space for "clicking" whichever control has focus has been around
for a while. I don't remember offhand -- it may depend on the setting
in System Preferences that governs whether all controls can get
keyboard focus.
Which version of macOS are you running?
Thanks for the comments.

On my development machine running 10.12.6 pressing the spacebar will dismiss a simple NSAlert. This is because in System Preferences > Keyboard > Shortcuts > Full Keyboard Access > All Controls was selected. (For some reason it took forever to discover this.)

When "All Controls" is selected the control with focus will have a focus ring drawn around it and pressing the spacebar will "click" the control with focus. Also pressing the tab key will move the keyboard focus between controls.

Setting a control key equivalent to the return key will make it the default control and it will be blue. The default control can be "clicked" by pressing the return key.

One common place where you can see all of this in action is in the alert when emptying the trash in Finder.

At one time this may have been all in my muscle memory but if you have been using your iPhone day in and day out for the last many years then you may need a referesher.

--Richard Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net
Ben Kennedy
2018-09-10 18:17:22 UTC
Permalink
Post by Richard Charles
On my development machine running 10.12.6 pressing the spacebar will dismiss a simple NSAlert. This is because in System Preferences > Keyboard > Shortcuts > Full Keyboard Access > All Controls was selected. (For some reason it took forever to discover this.)
When "All Controls" is selected the control with focus will have a focus ring drawn around it and pressing the spacebar will "click" the control with focus. Also pressing the tab key will move the keyboard focus between controls.
Setting a control key equivalent to the return key will make it the default control and it will be blue. The default control can be "clicked" by pressing the return key.
Son of a gun. Thanks for elucidating this Richard.

I guess I've had full keyboard access turned on for some time. Quite awhile ago I noticed these focus rings start showing up in alert panels, but it never occurred to me to press the space bar.

I had actually been intending to file a bug report decrying the ambiguity between the focus ring and the blue backfill insofar as which control gets acted upon. (I didn't realize that these signify two different activation methods.)

-b

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net
Richard Charles
2018-09-10 19:39:34 UTC
Permalink
Post by Ben Kennedy
Son of a gun. Thanks for elucidating this Richard.
Actually Andy Lee was right on when he suggested "it may depend on the setting in System Preferences that governs whether all controls can get keyboard focus". However I could not see what "All controls" had to do with pressing the spacebar so I stumbled upon my insight independently of Andy's comment.

Apple could do a better job of documenting this behavior somewhere for developers and users.

--Richard Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net

Loading...