close About Snapdrop page on Escape Keydown

This commit is contained in:
schlagmichdoch 2022-12-30 17:09:15 +01:00
parent a7a91df558
commit 009fcd7745

View file

@ -228,11 +228,11 @@ class Dialog {
this.$el = $(id); this.$el = $(id);
this.$el.querySelectorAll('[close]').forEach(el => el.addEventListener('click', e => this.hide())) this.$el.querySelectorAll('[close]').forEach(el => el.addEventListener('click', e => this.hide()))
this.$el.querySelectorAll('[role="textbox"]').forEach((el) => { this.$el.querySelectorAll('[role="textbox"]').forEach((el) => {
el.addEventListener("keydown", (e) => { el.addEventListener("keydown", (e) => {
if (e.key === "Escape") { if (e.key === "Escape") {
this.hide(); this.hide();
} }
}); });
}) })
this.$autoFocus = this.$el.querySelector('[autofocus]'); this.$autoFocus = this.$el.querySelector('[autofocus]');
} }
@ -655,6 +655,13 @@ Events.on('load', () => {
animate(); animate();
}); });
// close About Snapdrop page on Escape
window.addEventListener("keydown", (e) => {
if (e.key === "Escape") {
window.location.hash = '#';
}
});
Notifications.PERMISSION_ERROR = ` Notifications.PERMISSION_ERROR = `
Notifications permission has been blocked Notifications permission has been blocked
as the user has dismissed the permission prompt several times. as the user has dismissed the permission prompt several times.