LibWeb: Use el.aria_foo(), not el.has_attribute("aria-foo"_string)
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

This change replaces some element.has_attribute("aria-foo"_string) calls
with element.aria_value_foo() calls instead.
This commit is contained in:
sideshowbarker 2024-12-04 19:10:31 +09:00 committed by Tim Flynn
parent 5d47ba1e38
commit 989c2f9e87
Notes: github-actions[bot] 2024-12-05 13:05:52 +00:00

View file

@ -2374,13 +2374,15 @@ ErrorOr<String> Node::name_or_description(NameOrDescription target, Document con
}
}
} else if (role == ARIA::Role::spinbutton || role == ARIA::Role::slider) {
auto aria_valuenow = element.aria_value_now();
auto aria_valuetext = element.aria_value_text();
// iii. Range: If the embedded control has role range (e.g., a spinbutton or slider):
// a. If the aria-valuetext property is present, return its value,
if (element.has_attribute("aria-valuetext"_string))
builder.append(element.get_attribute("aria-valuetext"_string).value());
if (aria_valuetext.has_value())
builder.append(aria_valuetext.value());
// b. Otherwise, if the aria-valuenow property is present, return its value
else if (element.has_attribute("aria-valuenow"_string))
builder.append(element.get_attribute("aria-valuenow"_string).value());
else if (aria_valuenow.has_value())
builder.append(aria_valuenow.value());
// c. Otherwise, use the value as specified by a host language attribute.
else if (is<HTML::HTMLInputElement>(*node)) {
auto const& element = static_cast<HTML::HTMLInputElement const&>(*node);