CodeForPhilly / CodeForPhilly/codeforphilly-ng

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

Đang mở Phù hợp với người mới
#169 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
TypeScript
Star
1
Fork
1
Merge trung bình
5 ngày 3 giờ
Pull request đã merge (30 ngày)
9

Mô tả

## 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 `

` + `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).

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start with the MarkdownEditor implementation and compare its toolbar markup, activeButton state, toolbarRefs, and keydown handler with the Radix Toolbar API. Run apps/web/tests/MarkdownEditor.test.tsx; done means the hand-rolled focus management is replaced while the existing single-tab-stop and Arrow/Home/End behavior still passes.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
react, typescript
Lĩnh vực
accessibility, frontend
Loại issue
Tái cấu trúc
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
82/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.