mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
As Photoshop's menus on Windows: a tap on Alt (or F10) puts the keyboard on the in-window menu bar, with File lit; ← and → move along it, ↓, ↩ and Space open the lit menu with its first row lit, Esc or a click leave. Alt+letter opens the menu with that mnemonic, open or not, and in an open menu a letter runs the row with that mnemonic or opens its submenu. Mnemonics are assigned per menu level from the labels as shown (so translated), unique within the level: Photoshop's F E I L Y S T V W H for the top menus where the label has the letter, else the first unused letter, word starts first; only ASCII letters and digits, since those are the keys the keyboard reports. They are underlined while Alt is held, the bar is focused or the menu was opened from the keyboard; a menu opened with the mouse shows none until Alt, as on Windows. The underline is a layout job with the placeholder colour, so disabled rows stay dim; without underlines the text path is unchanged. The shortcuts defer to the focused bar as they do to an open menu, so E opens Edit instead of picking the Eraser and the arrows don't nudge the layer. Rows carry their mnemonic in the navigation state. macOS keeps the native menu bar, where this doesn't run. Tests: two unit tests (assignment, key letters) and seven harness tests (Alt focus and arrows, second Alt / Esc / click, Alt+letter and Enter, letters in an open menu, underline conditions, the layout job, and the whole app's shortcut deferral). Co-authored-by: Brandon Thomas <[email protected]>