mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-07-30 17:25:58 -04:00
webapi: real clicks on disabled form controls dispatch nothing
Fixes the "Real clicks on disabled elements must not dispatch events" subtest of WPT /dom/events/Event-dispatch-on-disabled-elements.html (verified in isolation): a testdriver click on a disabled button/input/select/textarea must not fire any pointer or mouse events, while a click on the re-enabled element must. WebDriver.click now checks the disabled state like HTMLElement.click does. The file's overall score is unchanged (4/9) because its four CSS transition/animation subtests hang awaiting animation events (no CSS animation engine in the renderless browser) and, being sequential promise_tests, also mask this subtest's result in the full run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
committed by
Karl Seguin
parent
6587778c12
commit
2c64c7fdbe
@@ -56,6 +56,18 @@ pub fn getComputedLabel(_: *const WebDriver, element: *Element, frame: *Frame) !
|
||||
// synchronously so the events are observable when the testdriver promise
|
||||
// resolves.
|
||||
pub fn click(_: *const WebDriver, element: *Element, frame: *Frame) !void {
|
||||
// Disabled form controls don't receive real click events at all.
|
||||
if (element.is(Element.Html)) |html| {
|
||||
switch (html._type) {
|
||||
inline .button, .input, .textarea, .select => |i| {
|
||||
if (i.getDisabled()) {
|
||||
return;
|
||||
}
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
|
||||
dispatchPointer(element, "pointerdown", 0, 1, frame);
|
||||
dispatchMouse(element, "mousedown", 0, 1, frame);
|
||||
dispatchPointer(element, "pointerup", 0, 0, frame);
|
||||
|
||||
Reference in New Issue
Block a user