Re: Ignoring subviews with VoiceOver
Re: Ignoring subviews with VoiceOver
- Subject: Re: Ignoring subviews with VoiceOver
- From: James Dempsey <email@hidden>
- Date: Tue, 16 Sep 2008 13:41:43 -0700
On Sep 16, 2008, at 12:19 PM, Matthew Mashyna wrote:
I have a custom view with a few subviews. I figured out how to get
voiceover to speak the text I want when the cursor is over the
custom view and not over one of the subviews. When the cursor goes
over a text subview it reads that text. When it's over an image it
says "image".
I don't want it to speak for all those subviews individually. I
really want it to say the same thing no matter where the cursor is.
Can I set some attribute of my custom view to get this behavior ?
Thanks,
Matt
It is hard to tell from your description how your custom view and its
subviews should be made accessible.
Usually if there is an image displayed, it is correct to set a
description of the image, so a VoiceOver user will know that there is
an image there, and know what the image represents. (You can do this
programmatically or in Interface Builder, if this is for SnowLeopard
there are other image description mechanisms as well). If something
is visible, it almost always should be described via accessibility as
well.
It is not terribly common to have an outer view pretend to be one of
its subviews.
You could potentially get almost all of the desired behavior by doing
the following, but I wouldn't encourage it:
1. Creating and use subclasses of the various cells for your
subviews. (It sounds like NSImageCell, NSTextFieldCell, would be two
that need to be subclassed).
2. Implementing -accessibilityIsIgnored to return YES. This will keep
the subviews from appearing.
3. In your custom superview:
- Implement -accessibilityIsIgnored to return NO, so your
custom view shows up.
- Implement all of the methods of the NSAccessibility (with
exceptions below) and have your custom view's implementation call the
text field cell's version.
- Don't override -accessibilityHitTest: since you want hit
testing to have the bounds of your custom, not the text field cell.
- If this is an editable, or selectable text field, -
accessibilityFocusedUIElement should reflect whether the text field
cell is focused, not your custom cell
4. Register in your custom view to get notified when the text's
selection and value changes, and send the appropriate accessibility
notifications
There still would likely be an issue with correct focused UI element
notifications, if the text field was editable or selectable.
If you are able to send me a screen shot of what you are trying to
make accessible, off list, I can try to give you some better direction.
-James
--------------------------------------------------
James Dempsey
AppKit Engineering
Apple
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