Skip to content

Preferences: Scroll to focused item when search cleared#16992

Open
colin-grant-work wants to merge 3 commits intomasterfrom
feature/preference-retain-focus-clear-search
Open

Preferences: Scroll to focused item when search cleared#16992
colin-grant-work wants to merge 3 commits intomasterfrom
feature/preference-retain-focus-clear-search

Conversation

@colin-grant-work
Copy link
Contributor

@colin-grant-work colin-grant-work commented Feb 13, 2026

What it does

Minor accessibility / style improvements in search editor
  • Replace 'Clear Search Results' <span> with <button> for better semantics and keyboard access.
  • Apply NLS to a couple of strings that were missing it
  • Add padding around the search input so that its focus border shows up fully
Preserve scroll on search clear

When a user searches for a preference, focuses a result, then clears the search, the editor previously always scrolled back to the top. This did not allow users to use focus to specify their interest after the search was cleared.

Now, if the user focuses a preference row during a search and that row is still within the visible viewport when the search is cleared, the editor scrolls to that preference in the unfiltered view and selects it in the tree. The tracked focus target is reset whenever the search term changes (so refining a query doesn't carry stale state), and is ignored if the user has scrolled the focused item out of the viewport before clearing.

How to test

  1. Open Settings and search for a term that returns multiple results (e.g. "font")
  2. Click on or Tab to a specific preference row (it should highlight)
  3. Clear the search — the editor should scroll to that preference in the full list rather than jumping to the top
  4. Repeat, but after focusing a preference, scroll it out of view, then clear — the editor should scroll to top as before
  5. Repeat, but after focusing a preference, refine the search query (type more characters), then clear without focusing anything new — the editor should scroll to top

Follow-ups

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

@github-project-automation github-project-automation bot moved this to Waiting on reviewers in PR Backlog Feb 13, 2026
Copy link
Member

@ndoschek ndoschek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @colin-grant-work!

Unfortunately, the "scroll to focused item" feature doesn't seem to work for me, neither in the browser nor in the electron example. When I clear the search after focusing a preference, it always scrolls back to the top:

Screencast.2026-02-16.14.21.05.mp4

But maybe I am overlooking something? TIA

semicolon

Co-authored-by: Nina Doschek <ndoschek@eclipsesource.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on reviewers

Development

Successfully merging this pull request may close these issues.

2 participants