mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
script: Stop handling native mousedown
and mouseup
for disabled elements (#38671)
According to spec of [hit-test](https://w3c.github.io/uievents/#hit-test) for native mouse event, mousedown/mouseup should also be excluded when interacting with disabled element, even tho it may be the frontmost of [elementFromPoint](https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint). Testing: Now it matches the behaviour of other browsers in #38670 for disabled element. Also testdriver test: `tests\wpt\tests\html\semantics\disabled-elements\disabled-event-dispatch.tentative.html` has 4 more passing tests. Fixes: Part of #38670. Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
parent
89bd01a3b4
commit
dafb0abf31
1 changed files with 6 additions and 6 deletions
|
@ -530,12 +530,12 @@ impl DocumentEventHandler {
|
|||
|
||||
let node = el.upcast::<Node>();
|
||||
debug!("{:?} on {:?}", event.action, node.debug_str());
|
||||
// Prevent click event if form control element is disabled.
|
||||
if let MouseButtonAction::Click = event.action {
|
||||
// The click event is filtered by the disabled state.
|
||||
if el.is_actually_disabled() {
|
||||
return;
|
||||
}
|
||||
|
||||
// https://w3c.github.io/uievents/#hit-test
|
||||
// Prevent mouse event if element is disabled.
|
||||
// TODO: also inert.
|
||||
if el.is_actually_disabled() {
|
||||
return;
|
||||
}
|
||||
|
||||
let dom_event = DomRoot::upcast::<Event>(MouseEvent::for_platform_mouse_event(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue