I want to associate a keyboard shortcut with a particular share sheet item in Safari. In Ventura 13.0.1, Safari 16.1, the Share menu item no longer has submenus within the menu bar, it's an ellipses item. When I select it, I get this malarky:
"Save to Pinboard" has a blue rectangle because I have the "Keyboard navigation" switch turned on in System Settings. I cannot use that function to select it, however—that works elsewhere in the system but not in this share sheet for whatever reason (yay accessibility, Apple). I can switch items with Tab and Shift-Tab, but Enter doesn't execute. KM's Click at Found Image seems not an ideal solution because the share sheet has some transparency as you can see in the screenshot.
Hi @Somfy. Yes, it seems like Apple is making some aspects of the UI more difficult to automate. Don't get me started on the new System Settings (vs. System Preferences). Grrrrrr!
With respect to your challenge, you might be able to piece together KM and a Shortcut.
I'm not clear on your exact objective, but maybe you could pass the information you want to share from KM to the shortcut. The last action will cause this window to appear...
The suggestion to look at Shortcuts was worth the price of admission! I'd never even thought of it.
Don't feel bad about not working it through—even what you've posted here overshoots the mark. Literally all I wanted to do was use the Save to Pinboard target with Pins. (Yes, I'm aware there's a bookmarklet. I like Pins better.)
So actually all I need is the Share action in Shortcuts (edit: well, and "Get current webpage in Safari"). The resulting menu is entirely responsive to keyboard input, so I can just invoke the Share shortcut, then have KM type "s" (For Save to . . .) and hit enter.
Very, very silly that this is necessary, but it works.
Glad it worked out. If working only on macOS, I always prefer to use Keyboard Maestro over the Shortcuts app (which is infamously buggy), but in some cases, it seems that Apple leaves us with no alternative.
While the Shortcuts-based solution @_jims suggested is almost certainly superior, even with Shortcuts' bugs, and I would probably continue using it for this use case as well, it's worth pointing out that while Enter can no longer be used to select an item from the new Share menu, the spacebar can.