Skip to content

Select with selectionMode="multiple" ignores selectAll() and Cmd/Ctrl+A #10958

Open

Description

@deebov

Provide a general summary of the issue here

In a Select with selectionMode="multiple", "select all" does nothing. Both state.selectionManager.selectAll() (via SelectStateContext) and Cmd/Ctrl+A in the open list leave the selection unchanged, and onChange is never called. Selecting items one at a time works, and the same actions work on a standalone ListBox.

🤔 Expected Behavior?

Every enabled item is selected, and onChange is called with all keys. This is what happens in a standalone ListBox with selectionMode="multiple".

😯 Current Behavior

Nothing is selected, onChange is not called, and nothing is logged.

StackBlitz Reproduction

https://stackblitz.com/github/deebov/rac-select-multiple-select-all?file=src%2FApp.tsx

🖥️ Steps to Reproduce

  1. Open the "Fruits" Select in section 1 of the repro.
  2. With the list focused, press Cmd/Ctrl+A, or click the selectionManager.selectAll() button inside the popover. value stays [] and onChange calls stays 0.
  3. Click "Apple". value becomes ["Apple"] and onChange calls becomes 1, so the state itself is wired correctly.
  4. For comparison, focus the standalone ListBox in section 2 and press Cmd/Ctrl+A. The selection becomes "all".
function SelectAllButton() {
  let state = useContext(SelectStateContext);
  return <Button onPress={() => state?.selectionManager.selectAll()}>Select all</Button>;
}

<Select selectionMode="multiple" value={value} onChange={setValue}>
  <Label>Fruits</Label>
  <Button><SelectValue /></Button>
  <Popover>
    <ListBox>
      <ListBoxItem id="apple">Apple</ListBoxItem>
      <ListBoxItem id="banana">Banana</ListBoxItem>
    </ListBox>
    <SelectAllButton />
  </Popover>
</Select>

💁 Possible Solution

SelectionManager.selectAll() sets the selection to 'all', and useSelectState drops that value in the list state's onSelectionChange:

onSelectionChange: (keys: Selection) => {
  // impossible, but TS doesn't know that
  if (keys === 'all') {
    return;
  }
  ...
}

The guard was added in #8734, when Select moved from useSingleSelectListState to useListState to support multiple selection. In single selection 'all' really is impossible, but in multiple selection both selectAll() and Cmd/Ctrl+A produce it.

Turning 'all' into the enabled item keys fixes both cases in the repro (tested by patching node_modules):

if (keys === 'all') {
  keys = new Set(
    [...listState.collection.getKeys()].filter(
      key => listState.collection.getItem(key)?.type === 'item' && !listState.selectionManager.isDisabled(key)
    )
  );
}

This may be related to #10147. In both cases the problem comes from useSelectState storing the selection as a plain Key[], which loses information that Selection carries: the anchor key there, and 'all' here. If that is being reworked, it would be good to cover 'all' as well.

🔦 Context

We build a multi-select dropdown on Select with selectionMode="multiple", with a "Select all" action in the popover footer. Right now we work around this by calling state.setValue() with the item keys ourselves, but users who reach for selectionManager.selectAll() get a silent no-op, and the keyboard shortcut stays broken.

Version

react-aria-components 1.22.1, react-stately 3.51.0, react 19.3.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

macOS 15

🧢 Your Company/Team

Untitled UI

🕷 Tracking Issue

untitleduico/react#201

Activity

  1. snowystinger commented on Nov 12, 2026

    @snowystinger
    Member

    Out of curiosity, why not make an additional item "All"

  2. deebov commented on Nov 13, 2026

    @deebov
    Author

    @snowystinger Then I guess the consumer would have to subtract the items when one of the items is being de-selected in "all" mode? I think sometimes you want to select all except a few.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions