textmate/textmate — pull request #1234 by dusek (2014-06-22 20:50:44+00:00)
Title: Use NSAccessibilitySharedFocusElements in OakChooser

This new 10.10 API allows one to mark, for some UI element, a set of UI
elements to track selection. VoiceOver (and other accessibility clients)
will then track and announce selection (cursor) changes not only in the
currently focused element, but also for all elements contained in its
"shared focus elements" array. This is a perfect fit for search field
with a table of results. In fact it is used for new 10.10 Spotlight -
its search field's shared focus element is the table containing the results.

As NSAccessibilitySharedFocusElements is available only in the 10.10 SDK,
so make a way to use its value with previous SDKs (with which TextMate
is currently compiled).

We also retain the kind-of-hacky solution for pre-10.10 OSes introduced in
and instead use NSAccessibilitySharedFocusElements.

This code was tested in all 6 fields of a 3×2 matrix:
* compiled with 10.8, 10.9 and 10.10 SDK
* run on 10.9 and 10.10 (DP2)

For user, this means more standard behavior (says the same "completion selected"
thing as with Spotlight) and a bit more correctness (no extra space
before beginning / after end of search field on braille display).

For developer, this means once we stop supporting 10.9, we will be ready to
drop a lot of code which, while serving us well to make the choosers more
user friendly on pre-10.10, will no longer be needed.

I release this patch (and any possible subsequent follow-up patches in this pull request)
to public domain.