1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:17:35 +00:00

LibWeb: Make HTML{Button,Select,TextArea}Element focusable

From the HTML spec:

    Modulo platform conventions, it is suggested that the following
    elements should be considered as focusable areas and be sequentially
    focusable:

      ...
    - button elements
    - select elements
    - textarea elements
      ...

Also add a spec link to the existing HTMLAnchorElement::is_focusable().

Note that this still doesn't allow triggering keyboard-focused buttons,
checkboxes, or radio buttons - we don't seem to run the expected
activation behavior for any of them.
This commit is contained in:
Linus Groh 2022-03-26 18:05:48 +00:00 committed by Andreas Kling
parent 80506a161f
commit de53eb825a
4 changed files with 14 additions and 0 deletions

View file

@ -23,6 +23,8 @@ public:
String target() const { return attribute(HTML::AttributeNames::target); }
String download() const { return attribute(HTML::AttributeNames::download); }
// ^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_html_anchor_element() const override { return true; }