Issue with Accessibility Visible Text Range

I am trying to draw NSPanels on texts of other apps using AXObserverAddNotification with the attribute of kAXValueChangedNotification on an AXTextArea

I need to detect if the text range on that text area is visible on the screen and I use kAXVisibleCharacterRangeAttribute to get the visible text range but it doesn’t include the top bar of the app and gives a range that starts from an index that is not visible.

Thus the panels are drawn on the app’s top bar like this gif when I scroll to bottom

How do I deal with this?

1 Like