Skip to content

Commit 0637f72

Browse files
author
Nathan LaPre
committed
Bug 1878358: Fix accessible name calculation for text field inputs, r=Jamie
Per the HTML-AAM spec, section 4.1.1, certain text field inputs have a specific accessible name calculation. That computation specifies that the client should first check the control's title attribute before checking the control's placeholder value. This revision adjusts the code such that we check the title first, then the placeholder; we were previously doing the reverse. This revision also removes the expected failures from the relevant web platform test meta file. Differential Revision: https://phabricator.services.mozilla.com/D201877
1 parent 58ec181 commit 0637f72

File tree

3 files changed

+3
-28
lines changed

3 files changed

+3
-28
lines changed

accessible/html/HTMLFormControlAccessible.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,10 @@ already_AddRefed<AccAttributes> HTMLTextFieldAccessible::NativeAttributes() {
303303
return attributes.forget();
304304
}
305305

306-
ENameValueFlag HTMLTextFieldAccessible::NativeName(nsString& aName) const {
307-
ENameValueFlag nameFlag = LocalAccessible::NativeName(aName);
306+
ENameValueFlag HTMLTextFieldAccessible::Name(nsString& aName) const {
307+
ENameValueFlag nameFlag = LocalAccessible::Name(aName);
308308
if (!aName.IsEmpty()) return nameFlag;
309309

310-
if (!aName.IsEmpty()) return eNameOK;
311-
312310
// text inputs and textareas might have useful placeholder text
313311
mContent->AsElement()->GetAttr(nsGkAtoms::placeholder, aName);
314312
return eNameOK;

accessible/html/HTMLFormControlAccessible.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class HTMLTextFieldAccessible : public HyperTextAccessible {
117117
virtual ~HTMLTextFieldAccessible() {}
118118

119119
// LocalAccessible
120-
virtual ENameValueFlag NativeName(nsString& aName) const override;
120+
virtual ENameValueFlag Name(nsString& aName) const override;
121121

122122
virtual void DOMAttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
123123
int32_t aModType,
Original file line numberDiff line numberDiff line change
@@ -1,24 +1 @@
11
[comp_tooltip.html]
2-
[textarea with placeholder and tooltip label]
3-
expected: FAIL
4-
5-
[text input with placeholder and tooltip label]
6-
expected: FAIL
7-
8-
[email input with placeholder and tooltip label]
9-
expected: FAIL
10-
11-
[password input with placeholder and tooltip label]
12-
expected: FAIL
13-
14-
[number input with placeholder and tooltip label]
15-
expected: FAIL
16-
17-
[search input with placeholder and tooltip label]
18-
expected: FAIL
19-
20-
[tel input with placeholder and tooltip label]
21-
expected: FAIL
22-
23-
[url input with placeholder and tooltip label]
24-
expected: FAIL

0 commit comments

Comments
 (0)