// fixtures/toolbar-roving.mjs — the formatting bar's keyboard // navigation, split out of toolbar.mjs to keep both under spec §12's // 300-line-per-module cap. // // It is a genuinely separate concern: toolbar.mjs decides what each // control DOES to the document, and this decides which control the // keyboard is on. Nothing here knows about ProseMirror. // setupRoving makes the whole bar ONE tab stop, with the arrow keys // moving between the controls inside it — the WAI-ARIA toolbar // pattern, which `role="toolbar"` in views/show.html is a promise to // implement. // // Without it the bar is fourteen tab stops between the shell bar and // the first word of the document, on every page load, for someone who // only wanted to type. It is also what a word processor does, so it is // what people's hands already expect. (Raised by the caret-placement // session, who was right that the fix is this and not reordering the // DOM: the bar sits above the paper visually, so DOM order already // matches reading order, and pulling focus order away from visual // order to save a few tab presses would trade a small annoyance for a // WCAG 2.4.3 Focus Order violation.) // // Left/Right rather than all four arrows, and preventDefault on the // ones handled: a closed native