MCPcopy Create free account
hub / github.com/UI5/webcomponents / _onclick

Method _onclick

packages/main/src/ToggleButton.ts:46–81  ·  view source on GitHub ↗
(e: MouseEvent)

Source from the content-addressed store, hash-verified

44 pressed = false;
45
46 _onclick(e: MouseEvent) {
47 e.stopImmediatePropagation();
48
49 if (this.nonInteractive) {
50 return;
51 }
52
53 const {
54 altKey,
55 ctrlKey,
56 metaKey,
57 shiftKey,
58 } = e;
59
60 const oldValue = this.pressed;
61 this.pressed = !oldValue;
62
63 const prevented = !this.fireDecoratorEvent("click", {
64 originalEvent: e,
65 altKey,
66 ctrlKey,
67 metaKey,
68 shiftKey,
69 });
70
71 if (prevented) {
72 e.preventDefault();
73 // value should be restored if click is prevented
74 this.pressed = oldValue;
75 return;
76 }
77
78 if (isSafari()) {
79 this.getDomRef()!.focus();
80 }
81 }
82}
83
84ToggleButton.define();

Callers

nothing calls this directly

Calls 2

isSafariFunction · 0.85
focusMethod · 0.45

Tested by

no test coverage detected