mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:27:45 +00:00
LibWeb: Fixed disabled checkbox input behaviour
Previously disabled checkbox could be checked by clicking on it's label
This commit is contained in:
parent
103613a3a9
commit
3383ae1598
1 changed files with 7 additions and 1 deletions
|
@ -87,12 +87,18 @@ void CheckBox::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& positi
|
||||||
|
|
||||||
void CheckBox::handle_associated_label_mousedown(Badge<Label>)
|
void CheckBox::handle_associated_label_mousedown(Badge<Label>)
|
||||||
{
|
{
|
||||||
|
if (!dom_node().enabled())
|
||||||
|
return;
|
||||||
|
|
||||||
m_being_pressed = true;
|
m_being_pressed = true;
|
||||||
set_needs_display();
|
set_needs_display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckBox::handle_associated_label_mouseup(Badge<Label>)
|
void CheckBox::handle_associated_label_mouseup(Badge<Label>)
|
||||||
{
|
{
|
||||||
|
if (!dom_node().enabled())
|
||||||
|
return;
|
||||||
|
|
||||||
// NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node.
|
// NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node.
|
||||||
NonnullRefPtr protect = *this;
|
NonnullRefPtr protect = *this;
|
||||||
|
|
||||||
|
@ -102,7 +108,7 @@ void CheckBox::handle_associated_label_mouseup(Badge<Label>)
|
||||||
|
|
||||||
void CheckBox::handle_associated_label_mousemove(Badge<Label>, bool is_inside_node_or_label)
|
void CheckBox::handle_associated_label_mousemove(Badge<Label>, bool is_inside_node_or_label)
|
||||||
{
|
{
|
||||||
if (m_being_pressed == is_inside_node_or_label)
|
if (m_being_pressed == is_inside_node_or_label || !dom_node().enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_being_pressed = is_inside_node_or_label;
|
m_being_pressed = is_inside_node_or_label;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue