Re: Controling the VoiceOver (back rectangle) focus frame
Re: Controling the VoiceOver (back rectangle) focus frame
- Subject: Re: Controling the VoiceOver (back rectangle) focus frame
- From: Josh Scotland <email@hidden>
- Date: Mon, 10 Aug 2015 23:19:04 -0700
Hi Aurélien,
Welcome to the list! We refer to the black rectangle as the VoiceOver cursor.
Nice find with the Photos app. If you get a chance, please file a bug for the VO cursor in Photos app not scrolling fully during selection change.
My first thought with the cursor not drawing correctly in your JNWCollectionView class was to post an NSAccessibilityFocusedUIElementChangedNotification, which you mentioned. Assuming the focused UI element changed, and VO didn’t update its cursor, the notification usually causes VO to “refocus” onto the right element.
Another thought is to check that the application’s NSAccessibilityFocusedUIElement is properly updating.
Sometimes a UI change is complex and VO has difficulty understanding what happened. In those cases, posting an NSAccessibilityLayoutChangedNotification can get VO update the cursor.
One last note — If your class is not inheriting from any AppKit class (e.g. NSCollectionView), then you’ll want to read up on accessibilityNotifiesWhenDestroyed. This ensures notifications can be sent from your custom class as efficiently as possible.
Documentation here: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSAccessibility_Protocol/#//apple_ref/occ/instp/NSObject/accessibilityNotifiesWhenDestroyed
Let me know if you’re still running into trouble!
Regards,
Josh
> On Jul 30, 2015, at 1:19 AM, Aurélien Hugelé <email@hidden> wrote:
>
> Hi list!
>
> This is my very first post on accessibility-dev, so please be indulgent since I'm pretty sure i'm not using the ideal vocabulary (in particular for the naming of the VoiceOver focus black rectangle).
>
> I'm not really experienced in Accessibility dev, and for my first implementation of Cocoa accessibility, I'm doing it the hard way! I'm trying to add accessibility to the (really well designed) open source JNWCollectionView class, which is basically a UICollectionView mimic for OS X (compatible with 10.8). I know there is a new NSCollectionView in El Capitan, but I need to be compatible with at least 10.10. By reading old cocoa-dev posts, I've also noticed that the *old* NSCollectionView class lacked accessibility support when it was made public in 10.5... probably because it was not an easy implementation!
>
> I've sucessfully implemented a large part of accessibility in this view (selection, reloadData, resizing etc... using <NSAccessibilityGroup> and <NSAccessibilityElement> objects as children), but I'm still struggling with an important aspect: VoiceOver focused UI Element black rectangle focus frame.
> Basically, my collection view displays cells in a grid layout (think Photos.app for example). When selecting a cell, focus UI element is correctly highlighted by VoiceOver with the black rectangle frame and the custom content of the cell is spelled.
>
> The problem arises when the user uses Control-Option down arrow (or just down arrow as Voice Over "follows" the selection) to select a cell that is at the very bottom of the view *that forces the collectionview to scroll up to display the cell entirely* :
> Photos.app has an incorrect behavior as selecting a cell that is only partially visible does not scroll to show the cell completely. Cocoa tableviews behave correctly : when you select a row that is only partially visible (clipped by the internal clip view), the tableview scrolls to show the row entirely. The JNWCollectionView does the same and it's very natural and convenient.
>
> Unfortunately, VoiceOver black rectangle focus does not follow the "move" of the selected/focused cell. It means the black rectangle is drawn at the wrong location (it typically have the correct size, but origin is incorrect as it is too low : it was the location of the cell *before* the scroll up).
> I'm using the new 10.10 Accessibility API, and I'm correctly modifying the accessibilityFrame property and accessibilityFrameInParentSpace of my "Faux UI Element" (which represents each cell, and inherits from NSAccessibilityElement) once it "moved" with the scroll. I'm also posting some notifications such as NSAccessibilityPostNotification(fauxElement, NSAccessibilityMovedNotification) or NSAccessibilityPostNotification(collectionView, NSAccessibilityFocusedUIElementChangedNotification) but this does not make VoiceOver redraw the black rectangle focus.
>
> The only solution I've found (which is a non ideal workaround) is to re-instantiate a new "Faux UI Element", set its new frame, replace the "old" focused UI Element (which was a member of the accessibilityChildren array) by the new one and posting the replacement using NSAccessibilityPostNotification(collectionView, NSAccessibilityFocusedUIElementChangedNotification). It works but is non ideal since it makes VoiceOver re-spells the focused element as if it changed completely (from the user point of view, it is the same element).
>
> As this is not clearly documented, I would like to know how to make VoiceOver redraw the black rectangle focus using the new frames of the NSAccessibilityElement, instead of destroying and reinstanciate a new faux UI element...
>
> Thanks for any help.
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Accessibility-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden