Further fix Safari quirk

This commit is contained in:
Neale Pickett 2022-04-26 11:55:43 -06:00
parent 92c7439ea5
commit a74b40935b
3 changed files with 15 additions and 7 deletions

View File

@ -65,7 +65,7 @@
<main class="mdl-layout__content"> <main class="mdl-layout__content">
<div class="flex"> <div class="flex">
<div class="mdl-card mdl-shadow--4dp input-methods"> <div class="mdl-card mdl-shadow--4dp input-methods mashable-area">
<div id="recv"> <div id="recv">
<!-- This div appears as a little light that turns on when someone's sending --> <!-- This div appears as a little light that turns on when someone's sending -->
<i class="material-icons" id="muted">volume_off</i> <i class="material-icons" id="muted">volume_off</i>

View File

@ -14,10 +14,10 @@ export class HTML extends Input{
// Listen to HTML buttons // Listen to HTML buttons
for (let e of document.querySelectorAll("button.key")) { for (let e of document.querySelectorAll("button.key")) {
e.addEventListener("contextmenu", e => { e.preventDefault(); return false }, {passive: false}) e.addEventListener("contextmenu", e => { e.preventDefault(); return false }, {passive: false})
e.addEventListener("touchstart", e => this.keyButton(e), {passive: true}) e.addEventListener("touchstart", e => this.keyButton(e), {passive: false})
e.addEventListener("touchend", e => this.keyButton(e), {passive: true}) e.addEventListener("touchend", e => this.keyButton(e), {passive: false})
e.addEventListener("mousedown", e => this.keyButton(e), {passive: true}) e.addEventListener("mousedown", e => this.keyButton(e), {passive: false})
e.addEventListener("mouseup", e => this.keyButton(e), {passive: true}) e.addEventListener("mouseup", e => this.keyButton(e), {passive: false})
e.contentEditable = false e.contentEditable = false
} }
} }
@ -33,6 +33,11 @@ export class HTML extends Input{
this.keyer.Dit(begin) this.keyer.Dit(begin)
} else if (event.target.id == "key") { } else if (event.target.id == "key") {
this.keyer.Straight(begin) this.keyer.Straight(begin)
} else {
return
}
if (event.cancelable) {
event.preventDefault()
} }
} }
} }

View File

@ -12,8 +12,11 @@
.key { .key {
width: 100%; width: 100%;
height: 6em; height: 6em;
user-select: none; }
-webkit-user-select: none; /* 2022-04-26 Safari still needs this */
.mashable-area {
user-select: none;
-webkit-user-select: none; /* 2022-04-26 Safari still needs this */
} }
.center { .center {