|
@@ -2,10 +2,15 @@ export default {
|
|
mounted() {
|
|
mounted() {
|
|
for (const event of this.events) {
|
|
for (const event of this.events) {
|
|
document.addEventListener(event, (evt) => {
|
|
document.addEventListener(event, (evt) => {
|
|
|
|
+ // https://github.com/zauberzeug/nicegui/issues/4290
|
|
|
|
+ if (!(evt instanceof KeyboardEvent)) return;
|
|
|
|
+
|
|
// https://stackoverflow.com/a/36469636/3419103
|
|
// https://stackoverflow.com/a/36469636/3419103
|
|
const focus = document.activeElement;
|
|
const focus = document.activeElement;
|
|
if (focus && this.ignore.includes(focus.tagName.toLowerCase())) return;
|
|
if (focus && this.ignore.includes(focus.tagName.toLowerCase())) return;
|
|
|
|
+
|
|
if (evt.repeat && !this.repeating) return;
|
|
if (evt.repeat && !this.repeating) return;
|
|
|
|
+
|
|
this.$emit("key", {
|
|
this.$emit("key", {
|
|
action: event,
|
|
action: event,
|
|
altKey: evt.altKey,
|
|
altKey: evt.altKey,
|