Repository navigation
Reach menu button -> Radix - #1395
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| aria-label="User menu" | ||
| className="ml-2" | ||
| innerClassName="space-x-2" | ||
| title="User menu" |
There was a problem hiding this comment.
not sure what this was doing or if it's necessary to find a new spot for it
2226586 to
2b31391
Compare
aaa167e to
8c9e1ae
Compare
# Conflicts: # app/components/TopBarPicker.tsx # package-lock.json # package.json
| Content: ({ className, ...props }: DropdownMenuContentProps) => ( | ||
| <Content | ||
| // prevents focus ring showing up on trigger when you close the menu | ||
| onCloseAutoFocus={(e) => e.preventDefault()} |
There was a problem hiding this comment.
@zephraph I don't see anything in the menu button pattern or examples insisting that focus land on the button after clicking out. However this also seems to break focus returning to the button if you click it to close the menu, which seems wrong? Unsure what to do, but probably not a blocker.
There was a problem hiding this comment.
Focus going back to the button would be nice, but I don't think it's necessary. Depends on what the tab stack looks like at that point. If you close it and press tab or shift+tab does it go back to the button?
We can make a follow up, but I agree that it's not a blocker.
There was a problem hiding this comment.
It doesn't go back to the button, it seems to reset back to the top level of the page. When I remove out the preventDefault and get the default behavior back, it does work the way you want: focus is on the button, and tabbing starts from there. The problem is really just the focus ring. I'll make an issue to think about this more.
Nothing in the repo references these packages any more. The lockfile goes from 709 to 704 entries. `tslib` and `@react-router/node` stay installed as dependencies of other packages, so for those two this only tidies `package.json`. Lint, tsc, build, and the vitest suite pass. I did not run e2e locally. - `tslib` came from the Nx generator that created the repo ([source](https://github.com/nrwl/nx/blob/313552b/packages/react/src/schematics/init/init.ts#L55-L61)), along with `importHelpers: true` in tsconfig, which tells tsc to import helpers like `__awaiter` from tslib instead of inlining them. tsc never emitted our build (that was Babel, then Vite), but with `importHelpers` on, typechecking fails with TS2354 if tslib can't be resolved and the target needs a helper, as ours did while it was es2015. #2078 raised the target to es2020 and #3075 removed `importHelpers`. It is still installed through `@peculiar/x509` and others. - `@tailwindcss/container-queries` was added in #2654 for the `@container` and `@[48rem]:` variants on the instance metrics tabs, loaded as a plugin in `tailwind.config.ts`. Tailwind 4 [has container queries built in](https://github.com/tailwindlabs/tailwindcss-container-queries/blob/7a968b3/README.md?plain=1#L1-L2), and #2910 deleted the config file that loaded the plugin but left the package. - `@tanstack/react-query-devtools` was added in #1238 to show the React Query devtools panel in dev. It was commented out in cc67cff to keep it out of screenshots, and #3400 deleted the commented-out lines. - `react-is` and `@types/react-is` also came from the Nx generator, which adds them alongside styled-components ([source](https://github.com/nrwl/nx/blob/313552b/packages/react/src/utils/styled.ts#L18-L28)) because styled-components 5 has react-is as a peer dependency. We replaced styled-components with emotion in 451bef6. `@reach/menu-button` 0.16 also had react-is as a peer dependency until #1395 replaced it with Radix, and no package in the lockfile has had one since. Nothing in the repo has ever imported react-is, so the types were never used. - `@react-router/node` was added in #3400, following the [React Router SPA guide](https://github.com/remix-run/react-router/blob/f482813/docs/how-to/spa.md#L38), which says a project needs it for the build-time render of `index.html`. Our `entry.server.tsx` uses web streams and doesn't import it, and `@react-router/dev` already depends on the exact same version, so it stays installed.

The difficulty on this one seems to be mostly in the styling. We were relying a bit on Reach's built in stylesheet. One difference in Radix that makes things harder is that the components don't come by default with any identifier on them like a class or a data attribute that lets you style them (turns out this is not quite true but they don't seem super specific — better to use the classes anyway). You have to explicitly put a class on them. Most likely I will make a UI component that does that so we don't have to remember, just like with tabs.
https://www.radix-ui.com/docs/primitives/components/dropdown-menu
This adds another 20kb to the bundle. Kinda disappointing! Net line changes excluding lockfile are
157 insertions(+), 121 deletions(-). Adds accounted for byDropdownMenu.tsxand some extra CSS pulled from Reach (which we can probably clean up).To do