mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-24 13:35:12 +00:00
LibWeb: Fix input@type=button|submit|reset accessible-name computation
This change makes Ladybird conform to the requirements in the HTML-AAM spec at https://w3c.github.io/html-aam/#accname-computation for the cases of HTML input@type=button, input@type=submit, and input@type=reset elements. Otherwise, without this change, Ladybird fails to expose the expected accessible names for those cases.
This commit is contained in:
parent
12b7304876
commit
7a6813cdea
Notes:
github-actions[bot]
2024-11-25 10:22:27 +00:00
Author: https://github.com/sideshowbarker Commit: https://github.com/LadybirdBrowser/ladybird/commit/7a6813cdead Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2438 Reviewed-by: https://github.com/gmta ✅
1 changed files with 7 additions and 0 deletions
|
@ -2403,6 +2403,13 @@ ErrorOr<String> Node::name_or_description(NameOrDescription target, Document con
|
|||
}
|
||||
if (is<HTML::HTMLInputElement>(*element)) {
|
||||
auto& input = (const_cast<HTML::HTMLInputElement&>(static_cast<HTML::HTMLInputElement const&>(*element)));
|
||||
// https://w3c.github.io/html-aam/#input-type-button-input-type-submit-and-input-type-reset-accessible-name-computation
|
||||
// Otherwise use the value attribute.
|
||||
if (input.type_state() == HTML::HTMLInputElement::TypeAttributeState::Button
|
||||
|| input.type_state() == HTML::HTMLInputElement::TypeAttributeState::SubmitButton
|
||||
|| input.type_state() == HTML::HTMLInputElement::TypeAttributeState::ResetButton)
|
||||
if (auto value = input.get_attribute(HTML::AttributeNames::value); value.has_value())
|
||||
return value.release_value();
|
||||
// https://w3c.github.io/html-aam/#input-type-image-accessible-name-computation
|
||||
// Otherwise use alt attribute if present and its value is not the empty string.
|
||||
if (input.type_state() == HTML::HTMLInputElement::TypeAttributeState::ImageButton)
|
||||
|
|
Loading…
Add table
Reference in a new issue