Closed Bug 160792 Opened 22 years ago Closed 22 years ago

Accessibility APIs: use title attribute in more places

Categories

(Core :: Disability Access APIs, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: aaronlev, Assigned: aaronlev)

Details

Attachments

(1 file, 1 obsolete file)

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.
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+
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 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+
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+
checked in
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: