mui / mui/material-ui

[autocomplete] Custom Popper with "Action Option" keyboard support

Open
#45,224 7 comments 7 reactions 1 assignee View on GitHub

@DiegoAndai is already working on this.

Since Feb 6, 2025.

scope: autocomplete type: new feature waiting for 👍
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Hey,

I'm trying to implement an Autocomplete with a custom Popper and an "action Item" at the top of the list. The "action item" is a ListItemButton. This renders just fine, which is great, but I'm running into issues trying to add keyboard support to this implementation. The user should be able to Tab to the "action item" in order to interact with it but when I press Tab the Autocomplete closes.

I have not found any way to keep the menu open when I press the Tab key. Do you have any ideas on how I could achieve this?

Implementation:
Image

Popper Code:
Image

onKeyDown Handler Code (handleBaseKeyDown is mapped to the onKeyDown prop on Autocomplete):
Image

Search keywords:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.