Remove uses of window.event.

window.event is a deprecated global that's set to the currently
dispatched event.

- Opened and closed mentions box by clicking its icon in the top bar
- Left and right clicked on an inline channel name and saw context menu
  open both times
- Two-finger swiped on iOS and saw channel change
- Long-touched and dragged channel in network list on iOS and reordered
  the list successfully
This commit is contained in:
itsjohncs 2021-12-20 15:34:28 -08:00
parent e0bbf19d9d
commit 763047889d
5 changed files with 8 additions and 4 deletions

View file

@ -23,6 +23,10 @@ rules:
no-duplicate-imports: error no-duplicate-imports: error
no-else-return: error no-else-return: error
no-implicit-globals: error no-implicit-globals: error
no-restricted-globals:
- error
- event
- fdescribe
no-shadow: error no-shadow: error
no-template-curly-in-string: error no-template-curly-in-string: error
no-unsafe-negation: error no-unsafe-negation: error

View file

@ -227,7 +227,7 @@ export default {
network: this.network, network: this.network,
}); });
}, },
openMentions() { openMentions(event) {
eventbus.emit("mentions:toggle", { eventbus.emit("mentions:toggle", {
event: event, event: event,
}); });

View file

@ -19,7 +19,7 @@ export default {
channel: String, channel: String,
}, },
methods: { methods: {
openContextMenu() { openContextMenu(event) {
eventbus.emit("contextmenu:inline-channel", { eventbus.emit("contextmenu:inline-channel", {
event: event, event: event,
channel: this.channel, channel: this.channel,

View file

@ -348,7 +348,7 @@ export default {
event.item.classList.remove("ui-sortable-dragging-touch-cue"); event.item.classList.remove("ui-sortable-dragging-touch-cue");
this.startDrag = null; this.startDrag = null;
}, },
onDraggableTouchStart() { onDraggableTouchStart(event) {
if (event.touches.length === 1) { if (event.touches.length === 1) {
// This prevents an iOS long touch default behavior: selecting // This prevents an iOS long touch default behavior: selecting
// the nearest selectable text. // the nearest selectable text.

View file

@ -39,7 +39,7 @@ function listenForTwoFingerSwipes(onTwoFingerSwipe) {
document.body.addEventListener( document.body.addEventListener(
"touchend", "touchend",
function () { function (event) {
if (event.touches.length >= 2) { if (event.touches.length >= 2) {
return; return;
} }