fixup! ♻️(frontend) refactor screen share zoom pan with useMove and imperative DOM updates

This commit is contained in:
Ovgodd
2026-09-01 11:59:27 +02:00
parent d656367fa7
commit 7bf13245a6
7 changed files with 82 additions and 10 deletions
+28 -1
View File
@@ -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',
},
]
@@ -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<string, string>
}
) => {
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
@@ -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]
+10 -2
View File
@@ -793,7 +793,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",
@@ -803,10 +807,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": {
+10 -2
View File
@@ -793,7 +793,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",
@@ -803,10 +807,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": {
+10 -2
View File
@@ -793,7 +793,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",
@@ -803,10 +807,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": {
+10 -2
View File
@@ -793,7 +793,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",
@@ -803,10 +807,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": {