Trying to determine based on a CGPoint inside a window, what (if any) accessibility element is hit. Is this possible? Sort of an Accessibility Element hit test… Should return any accessibility element hit (including System created). Seems like there has to be a way to do this.
Trying to determine based on a CGPoint inside a window, what (if any) accessibility
Share
I fear that in order to achieve what you want, you’ll have to basically re-implement how e.g. browsers do the capture phase in their event handling in the DOM:
keyWindowor (if your App is multiscreen) the front most window of the screen which you’ll have to figure out through thewindowLeveletc.By now, we have handled the cases accessibility-element and element inside container.
There is one additional case to cover and that are accessibility-containers, which are themselves accessibility-elements:
We have a container, that did not yield an element for the point in question.
If it is an accessibility-element, check whether its frame contains the point, and
– if so, return
self,– if not, bail.
And by bail I always mean return nil.
Now grab all that logic, turn it into code, and put it in a category on
NSObject.