Skip to content

MarkdownEditor toolbar: use Radix Toolbar from radix-ui instead of the hand-rolled roving tabindex #169

Description

@themightychris

Context

PR #157 gave MarkdownEditor's formatting buttons role="toolbar", real names, and a hand-rolled roving tabindex (activeButton state + a keydown handler for Arrow/Home/End).

Problem

The roving tabindex is ~30 lines of bespoke focus management that duplicates what Radix's Toolbar primitive already does (roving focus, orientation, Home/End, RTL, and correct tabIndex bookkeeping). radix-ui is already a dependency of apps/web (radix-ui@^1.4.3) and exports Toolbar, so no new package is needed.

Proposal

Replace the <div role="toolbar"> + handleToolbarKeyDown + toolbarRefs/activeButton with Toolbar.Root / Toolbar.Button from radix-ui, keeping the aria-label="Formatting" and per-button names. apps/web/tests/MarkdownEditor.test.tsx already covers the single-tab-stop and Arrow/Home/End behaviour and should pass unchanged.

Deferred from plans/a11y-mechanical.md (PR #157).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions