mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Support the ARIA “sectionheader” & “sectionfooter” roles
This commit is contained in:
parent
203267fcc2
commit
1b165d887b
Notes:
github-actions[bot]
2024-12-16 14:57:25 +00:00
Author: https://github.com/sideshowbarker
Commit: 1b165d887b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2932
6 changed files with 153 additions and 4 deletions
|
@ -766,10 +766,16 @@ Optional<ARIA::Role> HTMLElement::default_role() const
|
|||
// complementary, main, navigation or region then (footer) role=contentinfo (header) role=banner. Otherwise,
|
||||
// role=generic.
|
||||
for (auto const* ancestor = parent_element(); ancestor; ancestor = ancestor->parent_element()) {
|
||||
if (first_is_one_of(ancestor->local_name(), TagNames::article, TagNames::aside, TagNames::main, TagNames::nav, TagNames::section))
|
||||
return ARIA::Role::generic;
|
||||
if (first_is_one_of(ancestor->role_or_default(), ARIA::Role::article, ARIA::Role::complementary, ARIA::Role::main, ARIA::Role::navigation, ARIA::Role::region))
|
||||
return ARIA::Role::generic;
|
||||
if (first_is_one_of(ancestor->local_name(), TagNames::article, TagNames::aside, TagNames::main, TagNames::nav, TagNames::section)) {
|
||||
if (local_name() == TagNames::footer)
|
||||
return ARIA::Role::sectionfooter;
|
||||
return ARIA::Role::sectionheader;
|
||||
}
|
||||
if (first_is_one_of(ancestor->role_or_default(), ARIA::Role::article, ARIA::Role::complementary, ARIA::Role::main, ARIA::Role::navigation, ARIA::Role::region)) {
|
||||
if (local_name() == TagNames::footer)
|
||||
return ARIA::Role::sectionfooter;
|
||||
return ARIA::Role::sectionheader;
|
||||
}
|
||||
}
|
||||
// then (footer) role=contentinfo.
|
||||
if (local_name() == TagNames::footer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue