Skip to content

Feature request: Pass focused option as prop to MenuListΒ #4482

@SoAsEr

Description

@SoAsEr

When creating a virtualized select, the easiest way to do so is to use react-window. However, this completely breaks auto scrolling when using the arrow keys. If the focused option index or value was passed as a prop to MenuList, this would be trivial to do correctly. Right now (AFAIK) the only reliable way of doing this sets a ref in the ariaLiveMessages onFocus function and then reads that ref in the MenuList component in a useEffect and scrolls if needed. This last part is also ugly, as it needs to iterate over its children and compare props as that's the only way it can access the filtered options.

It is possible that there is a way of doing this cleanly that I'm unaware of, but as far as I can tell the focused option is only ever presented to user side code through the isFocused Option prop and ariaLiveMessages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions