diff --git a/Tests/LibWeb/Text/expected/HTML/submit-button-click-when-disabled.txt b/Tests/LibWeb/Text/expected/HTML/submit-button-click-when-disabled.txt new file mode 100644 index 00000000000..e8f8428f142 --- /dev/null +++ b/Tests/LibWeb/Text/expected/HTML/submit-button-click-when-disabled.txt @@ -0,0 +1 @@ + PASS! Did not click diff --git a/Tests/LibWeb/Text/input/HTML/submit-button-click-when-disabled.html b/Tests/LibWeb/Text/input/HTML/submit-button-click-when-disabled.html new file mode 100644 index 00000000000..23068912be9 --- /dev/null +++ b/Tests/LibWeb/Text/input/HTML/submit-button-click-when-disabled.html @@ -0,0 +1,12 @@ + + + diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 2f4310573da..6ebbf87d772 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -496,7 +496,11 @@ JS::GCPtr HTMLElement::labels() // https://html.spec.whatwg.org/multipage/interaction.html#dom-click void HTMLElement::click() { - // FIXME: 1. If this element is a form control that is disabled, then return. + // 1. If this element is a form control that is disabled, then return. + if (auto* form_control = dynamic_cast(this)) { + if (!form_control->enabled()) + return; + } // 2. If this element's click in progress flag is set, then return. if (m_click_in_progress)