Add whiteboard keyboard shortcuts

YU
1h ago
+225-14

Allow users to switch between pen, eraser, and text tools using keyboard shortcuts (P, E, and T), reducing reliance on toolbar clicks and improving interaction efficiency. Repeated P presses cycle through pen colors, while repeated E presses cycle through eraser sizes. Pressing T toggles between the text tool and the previously selected pen or eraser.

Add always-visible shortcut labels beside the corresponding toolbar controls to improve discoverability. To prevent unintended tool changes, ignore shortcuts while typing in text inputs or editing text labels, on repeated keydown events, and when the whiteboard is inactive.
image

Close #618



Summary by cubic

Adds whiteboard keyboard shortcuts so users can switch tools without the toolbar: P selects the pen (repeated presses cycle pen colors), E selects the eraser (repeated presses cycle eraser sizes), and T toggles between the text tool and the previously selected pen or eraser.

  • Shortcuts fire only on unmodified keys and are ignored while typing in text inputs, on held-key repeats, when the board is locked or mid-draw, and when focus is outside the whiteboard; they also work when focus is on the toolbar.
  • Adds always-visible P/E/T labels next to the corresponding toolbar buttons plus aria-keyshortcuts attributes so the shortcuts are discoverable.