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' | 'recording'
| 'reaction' | 'reaction'
| 'fullscreen' | 'fullscreen'
| 'zoom-in'
| 'zoom-out'
| 'zoom-reset'
| 'zoom-pan'
export const getShortcutDescriptorById = (id: ShortcutId) => export const getShortcutDescriptorById = (id: ShortcutId) =>
shortcutCatalog.find((item) => item.id === id) shortcutCatalog.find((item) => item.id === id)
@@ -24,7 +28,7 @@ export type ShortcutDescriptor = {
id: ShortcutId id: ShortcutId
category: ShortcutCategory category: ShortcutCategory
shortcut?: Shortcut shortcut?: Shortcut
kind?: 'press' | 'longPress' kind?: 'press' | 'longPress' | 'arrows'
code?: string // used when kind === 'longPress' (KeyboardEvent.code) code?: string // used when kind === 'longPress' (KeyboardEvent.code)
description?: string description?: string
} }
@@ -86,4 +90,27 @@ export const shortcutCatalog: ShortcutDescriptor[] = [
category: 'interaction', category: 'interaction',
shortcut: { key: 'P', ctrlKey: true, shiftKey: true }, 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, shiftLabel,
plusLabel, plusLabel,
noShortcutLabel, noShortcutLabel,
keyLabels,
}: { }: {
controlLabel: string controlLabel: string
commandLabel: string commandLabel: string
@@ -33,10 +34,12 @@ export const formatShortcutLabelForSR = (
shiftLabel: string shiftLabel: string
plusLabel: string plusLabel: string
noShortcutLabel: string noShortcutLabel: string
// Spelled-out names for keys screen readers may skip or mispronounce.
keyLabels?: Record<string, string>
} }
) => { ) => {
if (!shortcut) return noShortcutLabel if (!shortcut) return noShortcutLabel
const key = shortcut.key?.toUpperCase() const key = keyLabels?.[shortcut.key] ?? shortcut.key?.toUpperCase()
if (!key) return noShortcutLabel if (!key) return noShortcutLabel
const ctrlWord = isMacintosh() ? commandLabel : controlLabel const ctrlWord = isMacintosh() ? commandLabel : controlLabel
const altWord = isMacintosh() ? optionLabel : altLabel const altWord = isMacintosh() ? optionLabel : altLabel
@@ -12,6 +12,9 @@ export const useShortcutFormatting = () => {
const formatVisual = useCallback( const formatVisual = useCallback(
(shortcut?: Shortcut, code?: string, kind?: string) => { (shortcut?: Shortcut, code?: string, kind?: string) => {
if (kind === 'arrows') {
return t('shortcutsPanel.visual.arrows')
}
if (code && kind === 'longPress') { if (code && kind === 'longPress') {
const label = getKeyLabelFromCode(code) const label = getKeyLabelFromCode(code)
return t('shortcutsPanel.visual.hold', { key: label || '?' }) return t('shortcutsPanel.visual.hold', { key: label || '?' })
@@ -23,6 +26,9 @@ export const useShortcutFormatting = () => {
const formatForSR = useCallback( const formatForSR = useCallback(
(shortcut?: Shortcut, code?: string, kind?: string) => { (shortcut?: Shortcut, code?: string, kind?: string) => {
if (kind === 'arrows') {
return t('shortcutsPanel.sr.arrows')
}
if (code && kind === 'longPress') { if (code && kind === 'longPress') {
const label = getKeyLabelFromCode(code) const label = getKeyLabelFromCode(code)
return t('shortcutsPanel.sr.hold', { key: label || '?' }) return t('shortcutsPanel.sr.hold', { key: label || '?' })
@@ -35,6 +41,10 @@ export const useShortcutFormatting = () => {
shiftLabel: t('shortcutsPanel.sr.shift'), shiftLabel: t('shortcutsPanel.sr.shift'),
plusLabel: t('shortcutsPanel.sr.plus'), plusLabel: t('shortcutsPanel.sr.plus'),
noShortcutLabel: t('shortcutsPanel.sr.noShortcut'), noShortcutLabel: t('shortcutsPanel.sr.noShortcut'),
keyLabels: {
'+': t('shortcutsPanel.sr.plusKey'),
'-': t('shortcutsPanel.sr.minusKey'),
},
}) })
}, },
[t] [t]
+10 -2
View File
@@ -793,7 +793,11 @@
"raise-hand": "Hand heben oder senken", "raise-hand": "Hand heben oder senken",
"toggle-chat": "Chat anzeigen/ausblenden", "toggle-chat": "Chat anzeigen/ausblenden",
"toggle-participants": "Teilnehmende 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": { "sr": {
"control": "Steuerung", "control": "Steuerung",
@@ -803,10 +807,14 @@
"shift": "Umschalt", "shift": "Umschalt",
"plus": "plus", "plus": "plus",
"hold": "Halte {{key}} gedrückt", "hold": "Halte {{key}} gedrückt",
"arrows": "Pfeiltasten",
"plusKey": "Plus-Taste",
"minusKey": "Minus-Taste",
"noShortcut": "Kein Tastenkürzel" "noShortcut": "Kein Tastenkürzel"
}, },
"visual": { "visual": {
"hold": "Halte {{key}} gedrückt" "hold": "Halte {{key}} gedrückt",
"arrows": "↑ ↓ ← →"
} }
}, },
"fullScreenWarning": { "fullScreenWarning": {
+10 -2
View File
@@ -793,7 +793,11 @@
"raise-hand": "Raise or lower hand", "raise-hand": "Raise or lower hand",
"toggle-chat": "Toggle chat", "toggle-chat": "Toggle chat",
"toggle-participants": "Toggle participants", "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": { "sr": {
"control": "Control", "control": "Control",
@@ -803,10 +807,14 @@
"shift": "Shift", "shift": "Shift",
"plus": "plus", "plus": "plus",
"hold": "Hold {{key}}", "hold": "Hold {{key}}",
"arrows": "Arrow keys",
"plusKey": "Plus key",
"minusKey": "Minus key",
"noShortcut": "No shortcut" "noShortcut": "No shortcut"
}, },
"visual": { "visual": {
"hold": "Hold {{key}}" "hold": "Hold {{key}}",
"arrows": "↑ ↓ ← →"
} }
}, },
"fullScreenWarning": { "fullScreenWarning": {
+10 -2
View File
@@ -793,7 +793,11 @@
"raise-hand": "Lever ou baisser la main", "raise-hand": "Lever ou baisser la main",
"toggle-chat": "Afficher/Masquer le chat", "toggle-chat": "Afficher/Masquer le chat",
"toggle-participants": "Afficher/Masquer les participants", "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": { "sr": {
"control": "Contrôle", "control": "Contrôle",
@@ -803,10 +807,14 @@
"shift": "Majuscule", "shift": "Majuscule",
"plus": "plus", "plus": "plus",
"hold": "Maintenir {{key}}", "hold": "Maintenir {{key}}",
"arrows": "Touches fléchées",
"plusKey": "Touche plus",
"minusKey": "Touche moins",
"noShortcut": "Aucun raccourci" "noShortcut": "Aucun raccourci"
}, },
"visual": { "visual": {
"hold": "Maintenir {{key}}" "hold": "Maintenir {{key}}",
"arrows": "↑ ↓ ← →"
} }
}, },
"fullScreenWarning": { "fullScreenWarning": {
+10 -2
View File
@@ -793,7 +793,11 @@
"raise-hand": "Hand opsteken of laten zakken", "raise-hand": "Hand opsteken of laten zakken",
"toggle-chat": "Chat tonen/verbergen", "toggle-chat": "Chat tonen/verbergen",
"toggle-participants": "Deelnemers 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": { "sr": {
"control": "Control", "control": "Control",
@@ -803,10 +807,14 @@
"shift": "Shift", "shift": "Shift",
"plus": "plus", "plus": "plus",
"hold": "Houd {{key}} ingedrukt", "hold": "Houd {{key}} ingedrukt",
"arrows": "Pijltoetsen",
"plusKey": "Plus-toets",
"minusKey": "Min-toets",
"noShortcut": "Geen sneltoets" "noShortcut": "Geen sneltoets"
}, },
"visual": { "visual": {
"hold": "Houd {{key}} ingedrukt" "hold": "Houd {{key}} ingedrukt",
"arrows": "↑ ↓ ← →"
} }
}, },
"fullScreenWarning": { "fullScreenWarning": {