mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
dom: Firing "click" event as synthetic pointer event (#36274)
According to specification https://html.spec.whatwg.org/multipage/webappapis.html#fire-a-click-event "Firing a click event at target means firing a synthetic pointer event named click at target" So need to replace synthetic mouse event with "click" type to pointer event. https://w3c.github.io/pointerevents/#the-click-auxclick-and-contextmenu-events https://www.w3.org/TR/uievents/#event-type-click Firing "click" event could be triggered from script or by UA: - element.click() (https://html.spec.whatwg.org/multipage/interaction.html#dom-click) - form implicit submission (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#implicit-submission) - keyboard activation (space) --- - [x] ./mach build -d does not report any errors - [x] ./mach test-tidy does not report any errors - [x] There are tests for these changes tests/wpt/tests/shadow-dom/event-composed.html tests/wpt/tests/uievents/interface/click-event.htm Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
This commit is contained in:
parent
b925c31424
commit
3bc0eeab8f
7 changed files with 73 additions and 60 deletions
|
@ -395,7 +395,7 @@ impl HTMLElementMethods<crate::DomTypeHolder> for HTMLElement {
|
|||
Some(item_attr_values.into_iter().collect())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-click
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-click>
|
||||
fn Click(&self, can_gc: CanGc) {
|
||||
let element = self.as_element();
|
||||
if element.disabled_state() {
|
||||
|
@ -407,7 +407,7 @@ impl HTMLElementMethods<crate::DomTypeHolder> for HTMLElement {
|
|||
element.set_click_in_progress(true);
|
||||
|
||||
self.upcast::<Node>()
|
||||
.fire_synthetic_mouse_event_not_trusted(DOMString::from("click"), can_gc);
|
||||
.fire_synthetic_pointer_event_not_trusted(DOMString::from("click"), can_gc);
|
||||
element.set_click_in_progress(false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue