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
This commit is contained in:
Nathan LaPre 2024-02-14 23:24:04 +00:00
Родитель 58ec181e73
Коммит 0637f72bf7
3 изменённых файлов: 3 добавлений и 28 удалений

Просмотреть файл

@ -303,12 +303,10 @@ already_AddRefed<AccAttributes> HTMLTextFieldAccessible::NativeAttributes() {
return attributes.forget();
}
ENameValueFlag HTMLTextFieldAccessible::NativeName(nsString& aName) const {
ENameValueFlag nameFlag = LocalAccessible::NativeName(aName);
ENameValueFlag HTMLTextFieldAccessible::Name(nsString& aName) const {
ENameValueFlag nameFlag = LocalAccessible::Name(aName);
if (!aName.IsEmpty()) return nameFlag;
if (!aName.IsEmpty()) return eNameOK;
// text inputs and textareas might have useful placeholder text
mContent->AsElement()->GetAttr(nsGkAtoms::placeholder, aName);
return eNameOK;

Просмотреть файл

@ -117,7 +117,7 @@ class HTMLTextFieldAccessible : public HyperTextAccessible {
virtual ~HTMLTextFieldAccessible() {}
// LocalAccessible
virtual ENameValueFlag NativeName(nsString& aName) const override;
virtual ENameValueFlag Name(nsString& aName) const override;
virtual void DOMAttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType,

Просмотреть файл

@ -1,24 +1 @@
[comp_tooltip.html]
[textarea with placeholder and tooltip label]
expected: FAIL
[text input with placeholder and tooltip label]
expected: FAIL
[email input with placeholder and tooltip label]
expected: FAIL
[password input with placeholder and tooltip label]
expected: FAIL
[number input with placeholder and tooltip label]
expected: FAIL
[search input with placeholder and tooltip label]
expected: FAIL
[tel input with placeholder and tooltip label]
expected: FAIL
[url input with placeholder and tooltip label]
expected: FAIL