mirror of
https://github.com/pldubouilh/gossa.git
synced 2026-09-05 16:47:39 -04:00
Work around Firefox's transient activation requirement for opening the file picker (allow using shift as modifier)
This commit is contained in:
Vendored
+14
-2
@@ -749,8 +749,9 @@ document.body.addEventListener('keydown', e => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctrl keys
|
// Modifier keys
|
||||||
if ((e.ctrlKey || e.metaKey) && !e.shiftKey) {
|
if (!e.shiftKey) {
|
||||||
|
if (e.ctrlKey || e.metaKey) {
|
||||||
switch (e.code) {
|
switch (e.code) {
|
||||||
case 'KeyC':
|
case 'KeyC':
|
||||||
return prevent(e) || isRo() || cpPath()
|
return prevent(e) || isRo() || cpPath()
|
||||||
@@ -784,6 +785,17 @@ document.body.addEventListener('keydown', e => {
|
|||||||
return prevent(e) || dl(getASelected())
|
return prevent(e) || dl(getASelected())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Workaround Firefox requirement for transient activation
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/Security/User_activation
|
||||||
|
// Firefox requires user interaction (that is not reserved by the user agent)
|
||||||
|
// before a file picker can be displayed. This means that ctrl/meta are not
|
||||||
|
// usable as modifiers until the user clicks the page or presses another
|
||||||
|
// non-modifier key. To work around this, the shift key can be used, instead.
|
||||||
|
if (e.code == 'KeyU') {
|
||||||
|
return prevent(e) || isRo() || manualUpload.click()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (e.code) {
|
switch (e.code) {
|
||||||
case 'Tab':
|
case 'Tab':
|
||||||
|
|||||||
Reference in New Issue
Block a user