combobox: highlighted item never scrolls into view when there's no content part (Ark Command)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 83/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react, typescript
- Domain
- accessibility, frontend
Research direction
Start in combobox.dom.ts and trace how getItemEl finds an item when the component has no content part; the issue identifies the list as the fallback container. Reproduce with the provided Command example by moving the highlight past the visible items. Done when the highlighted item scrolls into view without a content part and existing content-part behavior still works.
Written by the indexing model from the issue text.
Description
🐛 Bug report
In a combobox without a content part, like Ark's Command, the highlighted item never scrolls into view. getItemEl only looks inside the content element, so it returns null. That leaves scrollToHighlightedItem with nothing to scroll, and scrollToIndexFn's getElement() returns null too.
💥 Steps to reproduce
- Render a
Commandwith more items than fit in the list (snippet below). - Focus the input.
- Press ArrowDown 15 times.
- "Item 15" is highlighted but off-screen. The list's
scrollTopstays at0.
💻 Link to reproduction
No sandbox yet. This is the snippet I used:
import { Command, createListCollection } from '@ark-ui/react/command'
const collection = createListCollection({
items: Array.from({ length: 30 }, (_, i) => ({ value: `item-${i}`, label: `Item ${i}` })),
})
export const Repro = () => (
<Command.Root collection={collection}>
<Command.Input placeholder="Search" />
<Command.List style={{ maxHeight: 200, overflow: 'auto' }}>
{collection.items.map((item) => (
<Command.Item key={item.value} item={item}>
<Command.ItemText>{item.label}</Command.ItemText>
</Command.Item>
))}
</Command.List>
</Command.Root>
)
🧐 Expected behavior
The list scrolls so the highlighted item stays visible, as it does when a content part is rendered.
🧭 Possible Solution
Fall back to the list in getItemEl (combobox.dom.ts):
return query(getContentEl(ctx) ?? getListEl(ctx), selector)
With that patched into the repro, the list scrolls (scrollTop 88) and "Item 15" is visible.
🌍 System information
| Software | Version(s) |
|---|---|
| Zag Version | 2.0.0-next.4 (same code on v2 head) |
| Browser | Chrome for Testing 151 |
| Operating System | macOS 15 |
📝 Additional information
Found while moving the Ark docs search to Command.
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 320
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 60
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from chakra-ui/zag
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
date-input: zoned values show in the timeZone prop (UTC) instead of their own zonePossibly taken @Yahiro025 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
dismissable: LayerDismissEvent isn't exportedPossibly taken @abu-tahir-0 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Slider: marker data-state ignores origin "center" / "end"Possibly taken @itisrmk claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
Maintainers usually reply within 1 day
Similar issues
-
feature
Difficulty 1/5 Under an hour Newbie friendliness 78/100
ChromeDevTools/chrome-devtools-mcp#3689 ·
Maintainers usually reply within 1 day
-
bug from-app needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nightly-labs/openbot#21303 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ADORSYS-GIS/CoopData#282 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OHDSI/Data2Evidence#3816 ·
Maintainers usually reply within 3 days
-
`ovsx verify` fails for a version older than the 100 newest of an extensionPossibly taken @trivikr claimed this today. Opencli
Difficulty 2/5 1-3 hours Newbie friendliness 81/100
eclipse-openvsx/openvsx#2482 · 2 comments ·
Maintainers usually reply within 1 day