Skip to content

fix(scm): restore focus to current history item after graph refresh#308425

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/280308-scm-graph-restore-focus-after-refresh
Open

fix(scm): restore focus to current history item after graph refresh#308425
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/280308-scm-graph-restore-focus-after-refresh

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

After a sync operation (push, pull, fetch) triggers a graph refresh, the SCM history tree resets its scroll position to the top and loses the current selection and focus.

This change restores the selection and focus to the current HEAD commit after each refresh by calling revealCurrentHistoryItem(). It falls back to the previous scroll-to-top behaviour only when there is no current item to reveal (e.g. the branch is not included in the active filter).

Before

  • User has a commit selected/focused in the SCM graph
  • User runs git pull or git push
  • Graph refreshes, scrolls to top, selection/focus is lost

After

  • User has a commit selected/focused in the SCM graph
  • User runs git pull or git push
  • Graph refreshes and scrolls to the current HEAD commit, preserving focus

Fixes #280308

After a sync operation triggers a graph refresh, the tree resets its
scroll position to the top and loses the current selection and focus.
This restores the selection and focus to the current HEAD commit after
each refresh by calling revealCurrentHistoryItem(), falling back to
the previous scroll-to-top behaviour only when there is no current
item to reveal (e.g. the ref is not in the active filter).

Fixes microsoft#280308
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.ts

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.

SCM Graph - selected/highlighted element lost focus after synchronizing changes if there is only one element above "Incoming Changes"

3 participants