#7628·ariakit

Keep a far keyboard move in view in a virtualized list with items of different sizes

Author: diegohazCreated Sep 24, 2026Updated Sep 26, 2026
Labelshas workaroundexperimental bugp2hard

Context

While testing #7614, which fixes #7612, an investigation of virtualized ComboboxSelect popups found that a far keyboard move can end off-screen when the items have different sizes. A separate check confirmed the behavior on main in Chrome, Firefox, and Safari.

Problem

When ComboboxRenderer renders items of different sizes without an itemSize, it estimates the offsets of the items that it has not measured yet. A keyboard move to a far item, such as a typeahead key, scrolls the list to the estimated offset, and the move's presentation then ends. When the renderer measures the newly rendered items, it moves the active item to its real offset. Nothing presents the item again, so the active item stays out of view, while aria-activedescendant still points to it.

Reproduction

typescript
import * as Ariakit from "@ariakit/react";
import { ComboboxRenderer } from "@ariakit/react-components/combobox/combobox-renderer";

const countries = [
  "Argentina", "Australia", "Austria", "Belgium", "Brazil", "Bulgaria",
  "Cambodia", "Cameroon", "Canada", "Chile", "China", "Colombia",
  "Denmark", "Ecuador", "Egypt", "Estonia", "Finland", "France",
  "Germany", "Ghana", "Greece", "Hungary", "Iceland", "India",
  "Ireland", "Italy", "Jamaica", "Japan", "Kenya", "Latvia",
  "Mexico", "Morocco", "Nepal", "Norway", "Peru", "Poland",
  "Portugal", "Romania", "Spain", "Sweden", "Thailand", "Turkey",
  "Uganda", "Ukraine", "Uruguay", "Vietnam", "Yemen", "Zambia",
].map((value, index) => ({ id: value, value, tall: index >= 12 }));

export default function Example() {
  return (
    <Ariakit.ComboboxProvider
      defaultItems={countries}
      defaultSelectedValue="Argentina"
    >
      <Ariakit.ComboboxSelect aria-label="Country" />
      <Ariakit.ComboboxPopover
        style={{ width: 200, maxHeight: 200, overflow: "auto" }}
      >
        <ComboboxRenderer items={countries} overscan={1}>
          {({ value, tall, ...item }) => (
            <Ariakit.ComboboxItem
              key={item.id}
              {...item}
              value={value}
              style={{ ...item.style, height: tall ? 72 : 24 }}
            />
          )}
        </ComboboxRenderer>
      </Ariakit.ComboboxPopover>
    </Ariakit.ComboboxProvider>
  );
}
  1. Click the select and wait until the popup is placed.
  2. Press U.

Observed: Uganda is the active item, but it is outside the visible part of the list. Expected: the list scrolls so that Uganda is visible.

The short items come first, so the estimate from the measured items is too small for the items near the end. The same happens with Y. With a fixed itemSize, the item is visible.

Pre-existing on main

Yes. It reproduces on main at 42ce68d in Chrome, Firefox, and Safari, with the popup already placed and with a popup whose positioning is held. The reproductions used temporary sandboxes only.

This is not a regression in SelectRenderer. The bug shipped with its first published release, @ariakit/react 0.2.11 and @ariakit/react-core 0.2.11 (June 28, 2023). Version 0.2.10 did not include SelectRenderer. See the release comparison and recording.

Why #7614 can finish without it

#7614 keeps a keyboard move made while the popup is positioning. This problem also happens in a popup that is already placed, and it comes from how the renderer measures items after a move.

Expected outcome

After a keyboard move in a virtualized list with items of different sizes, the active item is visible once the renderer has measured it.

Notes for the fix

The problem sits where the composite presentation of a moved item meets the renderer's measurement. One option is to keep the presentation alive until the item's position settles. Another is to keep the active item in place when the renderer measures items again.

Workaround

https://github.com/ariakit/ariakit/issues/7628#issuecomment-5808693226