Repository navigation
docs(useListFocus): add a recent files example block - #9577
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Thanks, this looks ready to merge. The Recent files block demonstrates useListFocus the way architecture:knowledge-contracts INV28 asks: the single tab stop, arrow keys, Home/End and wrapping all come from the hook, the new test fails when any of those options is removed, and the docs build shows the block on the hook's page. CI has not run yet because outside-contributor pull requests wait for a maintainer's ci:run label, so the remaining step is a green CI run.
[Automated review]
There was a problem hiding this comment.
Thanks, this is ready to merge. The Recent files block demonstrates useListFocus the way architecture:knowledge-contracts INV28 asks: the single tab stop, arrow keys, Home/End and wrapping all come from the hook, the new test fails when the hook or any of those options is removed, and the merged route entries match the generator. The remaining step is for the CI checks still running to finish green.
[Automated review]
Summary
Reader impact
A builder reading the
useListFocusdocs has no runnable example of the hook. After this change the hook's page shows a "Recent files" list of buttons that the hook drives from the keyboard, andastryx template useListFocusHookUsage <path>copies it.Source of truth
useListFocusand its HookDoc (packages/core/src/hooks/useListFocus.ts,useListFocus.doc.mjs).architecture:knowledge-contractsINV28.Correction
Adds a "Recent files" block (
exampleFor: 'useListFocus'): fourButtons in aVStackwired to the hook'slistRef,handleKeyDownandhandleFocus.orientation,wrapandhasHomeEndare the defaults, but I pass them so each behavior maps to an option a reader can see.role="toolbar", the WAI-ARIA pattern for controls that arrow keys move through, which the hook doc names. A plain labelledgroupis a one-line change if preferred.Changes
packages/cli/assets/templates/blocks/components/Hooks/useListFocusHookUsage.tsxand.doc.mjs.packages/cli/api/template/use-list-focus-hook-usage.test.tsx. It sits outsideassets/templates/, so the template viewer does not load it as a template..changeset/use-list-focus-recent-files-example.md(@astryxdesign/clipatch,[docs]).internal/shadcn-registry/routes.lock.jsonand its sandbox route inapps/sandbox/scripts/next-export-routes.json.Test Plan
use-list-focus-hook-usage.test.tsx: Tab stop, arrows with wrap, Home/End; all tests fail with the hook replaced by a no-op, and each option's test fails with that option turned off.tree.test.mjs, template and registry suites, docsite example coverage, typecheck, lint and changeset coverage pass.Related Issues
Closes #9479