mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Allow all elements with tabindex attribute to be focusable
This commit is contained in:
parent
154e9db033
commit
3bc061d028
Notes:
github-actions[bot]
2025-11-12 12:58:21 +00:00
Author: https://github.com/lpas
Commit: 3bc061d028
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6780
Reviewed-by: https://github.com/gmta ✅
5 changed files with 183 additions and 1 deletions
|
|
@ -4277,6 +4277,12 @@ bool Element::should_indicate_focus() const
|
|||
return false;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#tabindex-value
|
||||
bool Element::is_focusable() const
|
||||
{
|
||||
return HTML::parse_integer(get_attribute_value(HTML::AttributeNames::tabindex)).has_value();
|
||||
}
|
||||
|
||||
void Element::set_had_duplicate_attribute_during_tokenization(Badge<HTML::HTMLParser>)
|
||||
{
|
||||
m_had_duplicate_attribute_during_tokenization = true;
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ public:
|
|||
virtual void did_receive_focus() { }
|
||||
virtual void did_lose_focus() { }
|
||||
bool should_indicate_focus() const;
|
||||
virtual bool is_focusable() const override;
|
||||
|
||||
static GC::Ptr<Layout::NodeWithStyle> create_layout_node_for_display_type(DOM::Document&, CSS::Display const&, GC::Ref<CSS::ComputedProperties>, Element*);
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ void HTMLElement::set_dir(String const& dir)
|
|||
|
||||
bool HTMLElement::is_focusable() const
|
||||
{
|
||||
return is_editing_host() || get_attribute(HTML::AttributeNames::tabindex).has_value();
|
||||
return Base::is_focusable() || is_editing_host();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#dom-iscontenteditable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue