Accessibility APIs: use title attribute in more places

RESOLVED FIXED

Status

()

Core
Disability Access APIs
RESOLVED FIXED
16 years ago
16 years ago

People

(Reporter: Aaron Leventhal, Assigned: Aaron Leventhal)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

16 years ago
If the title attribute is different from accessible name, use accessible
description field to expose it.

However, if there is no accessible name for something, always use the title
attribute there.
(Assignee)

Comment 1

16 years ago
Created attachment 93986 [details] [diff] [review]
Implements rules described in bug, which were developed in coordination with screen reader vendor

Seeking r=

Comment 2

16 years ago
Comment on attachment 93986 [details] [diff] [review]
Implements rules described in bug, which were developed in coordination with screen reader vendor

r=kyle
Attachment #93986 - Flags: review+
Comment on attachment 93986 [details] [diff] [review]
Implements rules described in bug, which were developed in coordination with screen reader vendor

+  nsCOMPtr<nsITextContent> textContent(do_QueryInterface(mDOMNode));
+  if (!textContent)
+    GetAccName(name);
+  if (textContent || !name.IsEmpty()) {
+    // If text or if there's already a name, we might expose a description.
+    // If there is no name, then we know the title should really be exposed
there
+    nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
+    elt->GetAttribute(NS_LITERAL_STRING("title"), aDescription);

Is this not guaranteed to crash if mDOMNode is ever a text node? If mDOMNode is
a text node textContent will be non-null, and we'll end up QI'ing that text
node to an nsIDOMElement, which it's not, and calling a method on that null
pointer. Seems wrong, or at least fragile to me.
Attachment #93986 - Flags: needs-work+
(Assignee)

Comment 4

16 years ago
Created attachment 94101 [details] [diff] [review]
Don't even try to expose description for text nodes, since they aren't elements and can't have titles anyway

You're so right - how did I miss that? I guess that's why you're an sr=
Attachment #93986 - Attachment is obsolete: true

Comment 5

16 years ago
Comment on attachment 94101 [details] [diff] [review]
Don't even try to expose description for text nodes, since they aren't elements and can't have titles anyway

There are 3 conditions that makes a domNode have no accDescription:
1. it's a text node; or
2. it hasn't accName; or
3. its title attribute equals to its accName.
Is that right and clear?
r=kyle
Attachment #94101 - Flags: review+
(Assignee)

Comment 6

16 years ago
Thanks Kyle, I'll add that to the comment when I check in.
Summary: Accessibility APIs: use title attribute in more places → Accessibility APIs: use title attribute in more places
Comment on attachment 94101 [details] [diff] [review]
Don't even try to expose description for text nodes, since they aren't elements and can't have titles anyway

sr=jst
Attachment #94101 - Flags: superreview+
(Assignee)

Comment 8

16 years ago
checked in
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.