LibWeb: AnchorElement should be focusable with tabindex

This commit is contained in:
Lorenz A 2025-11-11 14:06:47 +01:00 committed by Jelle Raaijmakers
parent 3bc061d028
commit 8ca59e7c7e
Notes: github-actions[bot] 2025-11-12 12:58:14 +00:00
2 changed files with 5 additions and 5 deletions

View file

@ -31,7 +31,7 @@ public:
// ^EventTarget
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-a-element
virtual bool is_focusable() const override { return has_attribute(HTML::AttributeNames::href); }
virtual bool is_focusable() const override { return Base::is_focusable() || has_attribute(HTML::AttributeNames::href); }
virtual bool is_html_anchor_element() const override { return true; }

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 35 tests
31 Pass
4 Fail
33 Pass
2 Fail
Pass a should not be focusable by default.
Pass a[href] should be focusable by default.
Pass button should be focusable by default.
@ -19,13 +19,13 @@ Pass iframe should be focusable by default.
Pass #svg-a should not be focusable by default.
Pass #svg-text should not be focusable by default.
Pass img should not be focusable by default.
Fail A with tabindex=0 should be focusable.
Pass A with tabindex=0 should be focusable.
Pass a with tabindex=0 should be focusable.
Pass text with tabindex=0 should be focusable.
Pass SUMMARY#summary-out-tabindex0 with tabindex=0 should be focusable.
Pass SUMMARY#summary-second-tabindex0 with tabindex=0 should be focusable.
Pass IMG with tabindex=0 should be focusable.
Fail A with tabindex=-1 should be focusable.
Pass A with tabindex=-1 should be focusable.
Pass a with tabindex=-1 should be focusable.
Pass text with tabindex=-1 should be focusable.
Pass SUMMARY#summary-out-tabindex-negative with tabindex=-1 should be focusable.