mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Do not allow focusing "Actually Disabled" elements
This commit is contained in:
parent
21b705ee32
commit
09420406b8
Notes:
github-actions[bot]
2024-11-05 09:40:25 +00:00
Author: https://github.com/Simek
Commit: 09420406b8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2128
8 changed files with 34 additions and 4 deletions
|
@ -107,4 +107,9 @@ void HTMLButtonElement::activation_behavior(DOM::Event const& event)
|
|||
// 4. FIXME: Run the popover target attribute activation behavior given element.
|
||||
}
|
||||
|
||||
bool HTMLButtonElement::is_focusable() const
|
||||
{
|
||||
return enabled();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,9 @@ public:
|
|||
|
||||
// ^EventTarget
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-button-element
|
||||
virtual bool is_focusable() const override { return true; }
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#focusable-area
|
||||
// https://html.spec.whatwg.org/multipage/semantics-other.html#concept-element-disabled
|
||||
virtual bool is_focusable() const override;
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
|
|
|
@ -2590,4 +2590,9 @@ HTMLInputElement::ValueAttributeMode HTMLInputElement::value_attribute_mode() co
|
|||
return value_attribute_mode_for_type_state(type_state());
|
||||
}
|
||||
|
||||
bool HTMLInputElement::is_focusable() const
|
||||
{
|
||||
return m_type != TypeAttributeState::Hidden && enabled();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -155,7 +155,9 @@ public:
|
|||
|
||||
// ^EventTarget
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-input-element
|
||||
virtual bool is_focusable() const override { return m_type != TypeAttributeState::Hidden; }
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#focusable-area
|
||||
// https://html.spec.whatwg.org/multipage/semantics-other.html#concept-element-disabled
|
||||
virtual bool is_focusable() const override;
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
|
|
|
@ -613,4 +613,10 @@ void HTMLSelectElement::update_selectedness(JS::GCPtr<HTML::HTMLOptionElement> l
|
|||
}
|
||||
update_inner_text_element();
|
||||
}
|
||||
|
||||
bool HTMLSelectElement::is_focusable() const
|
||||
{
|
||||
return enabled();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,7 +59,9 @@ public:
|
|||
|
||||
// ^EventTarget
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-select-element
|
||||
virtual bool is_focusable() const override { return true; }
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#focusable-area
|
||||
// https://html.spec.whatwg.org/multipage/semantics-other.html#concept-element-disabled
|
||||
virtual bool is_focusable() const override;
|
||||
|
||||
// ^FormAssociatedElement
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
||||
|
|
|
@ -478,4 +478,9 @@ void HTMLTextAreaElement::queue_firing_input_event()
|
|||
});
|
||||
}
|
||||
|
||||
bool HTMLTextAreaElement::is_focusable() const
|
||||
{
|
||||
return enabled();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,10 @@ public:
|
|||
|
||||
// ^EventTarget
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-textarea-element
|
||||
virtual bool is_focusable() const override { return true; }
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#focusable-area
|
||||
// https://html.spec.whatwg.org/multipage/semantics-other.html#concept-element-disabled
|
||||
virtual bool is_focusable() const override;
|
||||
|
||||
virtual void did_lose_focus() override;
|
||||
virtual void did_receive_focus() override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue