Menu

Make the agent use the existing Dropdown Menu primitive, not a homemade absolutely-positioned list
📰

Make the agent use the existing Dropdown Menu primitive, not a homemade absolutely-positioned list

DEV Community: frontend·Sherotree·3 days ago
#vLJEuhmn
#devtofrontend#devto#dev#menu#primitive
Long article (484 words) — no AI summary yet.
Reading 0:00
15s threshold

The PR needs an overflow menu on a row or a header action. The agent adds a button, a useState open flag, and an absolutely positioned list of div s or links. Click-outside is a window listener. Escape is missing, or it closes and drops focus. The repo already has a DropdownMenu primitive with a trigger, a portal, arrow-key movement, typeahead, and focus return. Nearby card and table actions already use it.

I've started treating a homemade action list as an incomplete menu , not as a lighter dropdown. Toggling a panel is the easy part. A consistent trigger, keyboard movement, and a focus path back to the button are why the primitive is there.

Why the homemade menu shows up

A tutorial "custom dropdown" is a button plus a positioned list. The model can write that without finding components/DropdownMenu .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.