From e36ef9daac271b2056d26fa7841313eda7fc3451 Mon Sep 17 00:00:00 2001 From: Ovgodd Date: Tue, 1 Sep 2026 11:59:27 +0200 Subject: [PATCH] =?UTF-8?q?fixup!=20=E2=99=BB=EF=B8=8F(frontend)=20refacto?= =?UTF-8?q?r=20screen=20share=20zoom=20pan=20with=20useMove=20and=20impera?= =?UTF-8?q?tive=20DOM=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/features/shortcuts/catalog.ts | 29 ++++++++++++++++++- .../src/features/shortcuts/formatLabels.ts | 5 +++- .../shortcuts/hooks/useShortcutFormatting.ts | 10 +++++++ src/frontend/src/locales/de/rooms.json | 12 ++++++-- src/frontend/src/locales/en/rooms.json | 12 ++++++-- src/frontend/src/locales/fr/rooms.json | 12 ++++++-- src/frontend/src/locales/nl/rooms.json | 12 ++++++-- 7 files changed, 82 insertions(+), 10 deletions(-) diff --git a/src/frontend/src/features/shortcuts/catalog.ts b/src/frontend/src/features/shortcuts/catalog.ts index 60972ad9..ce7ce40e 100644 --- a/src/frontend/src/features/shortcuts/catalog.ts +++ b/src/frontend/src/features/shortcuts/catalog.ts @@ -16,6 +16,10 @@ export type ShortcutId = | 'recording' | 'reaction' | 'fullscreen' + | 'zoom-in' + | 'zoom-out' + | 'zoom-reset' + | 'zoom-pan' export const getShortcutDescriptorById = (id: ShortcutId) => shortcutCatalog.find((item) => item.id === id) @@ -24,7 +28,7 @@ export type ShortcutDescriptor = { id: ShortcutId category: ShortcutCategory shortcut?: Shortcut - kind?: 'press' | 'longPress' + kind?: 'press' | 'longPress' | 'arrows' code?: string // used when kind === 'longPress' (KeyboardEvent.code) description?: string } @@ -86,4 +90,27 @@ export const shortcutCatalog: ShortcutDescriptor[] = [ category: 'interaction', shortcut: { key: 'P', ctrlKey: true, shiftKey: true }, }, + // Screen share zoom keys are unmodified, so they are bound on the focused + // tile instead of being registered globally. They are listed here so the + // shortcuts panel stays exhaustive. + { + id: 'zoom-in', + category: 'interaction', + shortcut: { key: '+' }, + }, + { + id: 'zoom-out', + category: 'interaction', + shortcut: { key: '-' }, + }, + { + id: 'zoom-reset', + category: 'interaction', + shortcut: { key: '0' }, + }, + { + id: 'zoom-pan', + category: 'interaction', + kind: 'arrows', + }, ] diff --git a/src/frontend/src/features/shortcuts/formatLabels.ts b/src/frontend/src/features/shortcuts/formatLabels.ts index b421fea5..2ad3ef49 100644 --- a/src/frontend/src/features/shortcuts/formatLabels.ts +++ b/src/frontend/src/features/shortcuts/formatLabels.ts @@ -25,6 +25,7 @@ export const formatShortcutLabelForSR = ( shiftLabel, plusLabel, noShortcutLabel, + keyLabels, }: { controlLabel: string commandLabel: string @@ -33,10 +34,12 @@ export const formatShortcutLabelForSR = ( shiftLabel: string plusLabel: string noShortcutLabel: string + // Spelled-out names for keys screen readers may skip or mispronounce. + keyLabels?: Record } ) => { if (!shortcut) return noShortcutLabel - const key = shortcut.key?.toUpperCase() + const key = keyLabels?.[shortcut.key] ?? shortcut.key?.toUpperCase() if (!key) return noShortcutLabel const ctrlWord = isMacintosh() ? commandLabel : controlLabel const altWord = isMacintosh() ? optionLabel : altLabel diff --git a/src/frontend/src/features/shortcuts/hooks/useShortcutFormatting.ts b/src/frontend/src/features/shortcuts/hooks/useShortcutFormatting.ts index ec4c95d8..ed7770ff 100644 --- a/src/frontend/src/features/shortcuts/hooks/useShortcutFormatting.ts +++ b/src/frontend/src/features/shortcuts/hooks/useShortcutFormatting.ts @@ -12,6 +12,9 @@ export const useShortcutFormatting = () => { const formatVisual = useCallback( (shortcut?: Shortcut, code?: string, kind?: string) => { + if (kind === 'arrows') { + return t('shortcutsPanel.visual.arrows') + } if (code && kind === 'longPress') { const label = getKeyLabelFromCode(code) return t('shortcutsPanel.visual.hold', { key: label || '?' }) @@ -23,6 +26,9 @@ export const useShortcutFormatting = () => { const formatForSR = useCallback( (shortcut?: Shortcut, code?: string, kind?: string) => { + if (kind === 'arrows') { + return t('shortcutsPanel.sr.arrows') + } if (code && kind === 'longPress') { const label = getKeyLabelFromCode(code) return t('shortcutsPanel.sr.hold', { key: label || '?' }) @@ -35,6 +41,10 @@ export const useShortcutFormatting = () => { shiftLabel: t('shortcutsPanel.sr.shift'), plusLabel: t('shortcutsPanel.sr.plus'), noShortcutLabel: t('shortcutsPanel.sr.noShortcut'), + keyLabels: { + '+': t('shortcutsPanel.sr.plusKey'), + '-': t('shortcutsPanel.sr.minusKey'), + }, }) }, [t] diff --git a/src/frontend/src/locales/de/rooms.json b/src/frontend/src/locales/de/rooms.json index ccafc1e6..d5de0630 100644 --- a/src/frontend/src/locales/de/rooms.json +++ b/src/frontend/src/locales/de/rooms.json @@ -705,7 +705,11 @@ "raise-hand": "Hand heben oder senken", "toggle-chat": "Chat anzeigen/ausblenden", "toggle-participants": "Teilnehmende anzeigen/ausblenden", - "open-shortcuts-settings": "Tastenkürzel-Einstellungen öffnen" + "open-shortcuts-settings": "Tastenkürzel-Einstellungen öffnen", + "zoom-in": "In einen geteilten Bildschirm hineinzoomen", + "zoom-out": "Aus einem geteilten Bildschirm herauszoomen", + "zoom-reset": "Zoom des geteilten Bildschirms zurücksetzen", + "zoom-pan": "Im gezoomten geteilten Bildschirm navigieren" }, "sr": { "control": "Steuerung", @@ -715,10 +719,14 @@ "shift": "Umschalt", "plus": "plus", "hold": "Halte {{key}} gedrückt", + "arrows": "Pfeiltasten", + "plusKey": "Plus-Taste", + "minusKey": "Minus-Taste", "noShortcut": "Kein Tastenkürzel" }, "visual": { - "hold": "Halte {{key}} gedrückt" + "hold": "Halte {{key}} gedrückt", + "arrows": "↑ ↓ ← →" } }, "fullScreenWarning": { diff --git a/src/frontend/src/locales/en/rooms.json b/src/frontend/src/locales/en/rooms.json index 91992e6c..b9ba3ae9 100644 --- a/src/frontend/src/locales/en/rooms.json +++ b/src/frontend/src/locales/en/rooms.json @@ -704,7 +704,11 @@ "raise-hand": "Raise or lower hand", "toggle-chat": "Toggle chat", "toggle-participants": "Toggle participants", - "open-shortcuts-settings": "Open shortcuts settings" + "open-shortcuts-settings": "Open shortcuts settings", + "zoom-in": "Zoom in on a shared screen", + "zoom-out": "Zoom out on a shared screen", + "zoom-reset": "Reset the shared screen zoom", + "zoom-pan": "Move around a zoomed shared screen" }, "sr": { "control": "Control", @@ -714,10 +718,14 @@ "shift": "Shift", "plus": "plus", "hold": "Hold {{key}}", + "arrows": "Arrow keys", + "plusKey": "Plus key", + "minusKey": "Minus key", "noShortcut": "No shortcut" }, "visual": { - "hold": "Hold {{key}}" + "hold": "Hold {{key}}", + "arrows": "↑ ↓ ← →" } }, "fullScreenWarning": { diff --git a/src/frontend/src/locales/fr/rooms.json b/src/frontend/src/locales/fr/rooms.json index 6267b0fb..041cc939 100644 --- a/src/frontend/src/locales/fr/rooms.json +++ b/src/frontend/src/locales/fr/rooms.json @@ -704,7 +704,11 @@ "raise-hand": "Lever ou baisser la main", "toggle-chat": "Afficher/Masquer le chat", "toggle-participants": "Afficher/Masquer les participants", - "open-shortcuts-settings": "Ouvrir les réglages des raccourcis" + "open-shortcuts-settings": "Ouvrir les réglages des raccourcis", + "zoom-in": "Zoomer sur un écran partagé", + "zoom-out": "Dézoomer sur un écran partagé", + "zoom-reset": "Réinitialiser le zoom de l’écran partagé", + "zoom-pan": "Se déplacer dans un écran partagé zoomé" }, "sr": { "control": "Contrôle", @@ -714,10 +718,14 @@ "shift": "Majuscule", "plus": "plus", "hold": "Maintenir {{key}}", + "arrows": "Touches fléchées", + "plusKey": "Touche plus", + "minusKey": "Touche moins", "noShortcut": "Aucun raccourci" }, "visual": { - "hold": "Maintenir {{key}}" + "hold": "Maintenir {{key}}", + "arrows": "↑ ↓ ← →" } }, "fullScreenWarning": { diff --git a/src/frontend/src/locales/nl/rooms.json b/src/frontend/src/locales/nl/rooms.json index 86ed7033..5e368db8 100644 --- a/src/frontend/src/locales/nl/rooms.json +++ b/src/frontend/src/locales/nl/rooms.json @@ -704,7 +704,11 @@ "raise-hand": "Hand opsteken of laten zakken", "toggle-chat": "Chat tonen/verbergen", "toggle-participants": "Deelnemers tonen/verbergen", - "open-shortcuts-settings": "Sneltoets-instellingen openen" + "open-shortcuts-settings": "Sneltoets-instellingen openen", + "zoom-in": "Inzoomen op een gedeeld scherm", + "zoom-out": "Uitzoomen op een gedeeld scherm", + "zoom-reset": "Zoom van het gedeelde scherm herstellen", + "zoom-pan": "Navigeren in een ingezoomd gedeeld scherm" }, "sr": { "control": "Control", @@ -714,10 +718,14 @@ "shift": "Shift", "plus": "plus", "hold": "Houd {{key}} ingedrukt", + "arrows": "Pijltoetsen", + "plusKey": "Plus-toets", + "minusKey": "Min-toets", "noShortcut": "Geen sneltoets" }, "visual": { - "hold": "Houd {{key}} ingedrukt" + "hold": "Houd {{key}} ingedrukt", + "arrows": "↑ ↓ ← →" } }, "fullScreenWarning": {