Skip to content

Combobox closes when navigating items with keyboard (May release regression) #8298

Closed
@alirezamirian

Description

@alirezamirian

Provide a general summary of the issue here

It's a regression caused by the May release. Navigating past the last visible item scrolls the window closing the dropdown.

react-spectrum-combobox-bug.mov

🤔 Expected Behavior?

It should be possible to navigate listbox items.

😯 Current Behavior

The page scrolls unnecessarily, moving the combobox and closing the dropdown.

💁 Possible Solution

Not sure why, but this line is causing the window to scroll:

opts?.containingElement?.scrollIntoView?.({block: 'center', inline: 'center'});

Not sure about the root cause but originalTop and newTop are not equal after the May release.

🔦 Context

It happened in our library that's built on top of react aria, and the same issue was reproducible in react-spectrum too.

🖥️ Steps to Reproduce

  1. open https://codesandbox.io/p/sandbox/happy-elion-hqrj27?file=%2Fpackage.json
  2. resize window so that the combobox dropdown would be scrollable.
  3. open the combobox dropdown and navigate with keyboard to the last item.

Version

3.42.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

MacOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions