Skip to content

fix: Prevent page scroll on Home and End in Select, Multiselect and OptionList - #5262

Open
amanabiy wants to merge 1 commit into
fix/select-multiselect-listbox-alignmentfrom
fix/listbox-home-end
Open

amanabiy wants to merge 1 commit into
fix/select-multiselect-listbox-alignmentfrom
fix/listbox-home-end

Conversation

@amanabiy

@amanabiy amanabiy commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Description

When the list element has focus, Home and End moved the highlight and the browser also ran its native action, which scrolls the page or a scroll container to its top or bottom. The list's keydown handler from useListbox now prevents the native Home and End action. This applies to Select and Multiselect without a filter, embedded Multiselect and OptionList. With a filter, focus is in the input, and Home and End keep moving the text cursor.

From the OptionList accessibility review, question 2 (Home and End).

Related links, issue #, if available: AfZkAA6G9O2X

How has this been tested?

Unit tests in use-listbox.test.tsx: on the list, Home and End move the highlight and prevent the native action; through the filter input handler, they keep it. Unit tests for OptionList, Select, Multiselect, Autosuggest, Property filter and the shared list code pass, and eslint and tsc pass.

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@amanabiy
amanabiy force-pushed the fix/listbox-home-end branch from 9247cbf to ea49979 Compare November 6, 2026 09:13
@amanabiy
amanabiy changed the base branch from feat/add-option-list to fix/select-multiselect-listbox-alignment November 6, 2026 09:16
@amanabiy
amanabiy added this pull request to stack #5251 November 6, 2026 09:16
@amanabiy
amanabiy marked this pull request as ready for review November 6, 2026 09:26
@amanabiy
amanabiy requested a review from a team as a code owner November 6, 2026 09:26
@amanabiy
amanabiy requested review from georgylobko and removed request for a team November 6, 2026 09:26
@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.85%. Comparing base (d6cf6ec) to head (5f51d48).

Additional details and impacted files
@@                            Coverage Diff                            @@
##           fix/select-multiselect-listbox-alignment    #5262   +/-   ##
=========================================================================
  Coverage                                     97.85%   97.85%           
=========================================================================
  Files                                          1012     1012           
  Lines                                         32731    32736    +5     
  Branches                                      12128    12129    +1     
=========================================================================
+ Hits                                          32030    32035    +5     
  Misses                                          661      661           
  Partials                                         40       40           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ptionList

When the list element has focus, Home and End moved the highlight to the first or last option, and the browser also ran its native action, which scrolls the page or a scroll container to its top or bottom. The list's keydown handler from useListbox now prevents the native Home and End action. This applies to Select and Multiselect without a filter, embedded Multiselect and OptionList. With a filter, focus is in the input, and Home and End keep moving the text cursor.

This branch was successfully deployed

3 active deployments
dev-pages-react18 — 5f51d482 Deployed Nov 6, 2026 by jperals via deploy (React 18) / deploy #3227
dev-pages-react16 — 5f51d482 Deployed Nov 6, 2026 by jperals via deploy (React 16) / deploy #3227
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.

2 participants