Skip to content

[WIP] Fix combobox virtualizer option change on Enter key#36061

Draft
Copilot wants to merge 1 commit intomasterfrom
copilot/fix-combobox-selected-option-bug
Draft

[WIP] Fix combobox virtualizer option change on Enter key#36061
Copilot wants to merge 1 commit intomasterfrom
copilot/fix-combobox-selected-option-bug

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>[Bug]: Combobox Virtualizer: Selected option can be changed by pressing Enter on the last item</issue_title>
<issue_description>### Component

Combobox

Package version

Combobox Virtualizer in fluent ui v9 doc

React version

Combobox Virtualizer in fluent ui v9 doc

Environment

Combobox Virtualizer in fluent ui v9 doc

Current Behavior

Select the last option from the dropdown list, then press the Enter key twice in the input box. The selected option will change unexpectedly

Expected Behavior

The input value should not be changed when pressing Enter in the input box if the last option is selected

Reproduction

https://storybooks.fluentui.dev/react/?path=/docs/components-combobox--docs

Steps to reproduce

  1. Select the last option from the dropdown list.
  2. Press Enter twice in the input field.
  3. Observe that the selected option changes.

Image

Are you reporting an Accessibility issue?

None

Suggested severity

Urgent - No workaround and Products/sites are affected

Products/sites affected

https://storybooks.fluentui.dev/react/?path=/docs/components-combobox--docs

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.</issue_description>

<agent_instructions>There is a race condition involving the Combobox's active descendant detection logic and the Virtualizer. The Combobox attempts to focus the active element synchronously, but with the Virtualizer, the element isn't yet in the DOM, causing the focus to shift to the wrong element.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@dmytrokirpa Thank you for reporting this, @it950. It appears to be a race condition involving the Combobox's active descendant detection logic and the Virtualizer. The Combobox attempts to focus the active element synchronously, but with the Virtualizer, the element isn't yet in the DOM, causing the focus to shift to the wrong element. I don't have a solution at the moment, so this issue will require further investigation.

@dmytrokirpa
Copy link
Copy Markdown
Contributor

@copilot where are the actual code changes?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Combobox Virtualizer: Selected option can be changed by pressing Enter on the last item

2 participants