I have an extension that sends selected text to a rewriting tool. It’s only useful in editable fields, but in browsers and Electron apps, requirements: [paste] and [cut] don’t help — Chromium reports both as available everywhere. The dynamic population function could hide the action, but it’s sandboxed.
Meanwhile, macOS Accessibility does distinguish them:
osascript -e '
tell application "System Events"
return value of attribute "AXRole" of \
(value of attribute "AXFocusedUIElement" of \
(first application process whose frontmost is true))
end tell'
Returns AXWebArea for non-editable text, AXTextArea for input fields. Tested in Chrome and Electron apps.
Would it be feasible to expose this as a new requirement (e.g. editable) or add the focused element’s AX role to the context object?