mirror of
https://github.com/desktop/desktop
synced 2024-09-19 08:02:22 +00:00
Merge pull request #17387 from desktop/force-focus-to-selected-tab
Force focus to selected tab
This commit is contained in:
commit
03a90823cd
|
@ -2731,7 +2731,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
|
|||
/** This shouldn't be called directly. See `Dispatcher`. */
|
||||
public async _changeRepositorySection(
|
||||
repository: Repository,
|
||||
selectedSection: RepositorySectionTab
|
||||
selectedSection: RepositorySectionTab,
|
||||
forceButtonFocus: boolean = false
|
||||
): Promise<void> {
|
||||
this.repositoryStateCache.update(repository, state => {
|
||||
if (state.selectedSection !== selectedSection) {
|
||||
|
@ -2742,13 +2743,21 @@ export class AppStore extends TypedBaseStore<IAppState> {
|
|||
this.emitUpdate()
|
||||
|
||||
if (selectedSection === RepositorySectionTab.History) {
|
||||
return this.refreshHistorySection(repository)
|
||||
await this.refreshHistorySection(repository)
|
||||
} else if (selectedSection === RepositorySectionTab.Changes) {
|
||||
return this.refreshChangesSection(repository, {
|
||||
await this.refreshChangesSection(repository, {
|
||||
includingStatus: true,
|
||||
clearPartialState: false,
|
||||
})
|
||||
}
|
||||
|
||||
if (forceButtonFocus) {
|
||||
const repoSideBar = document.getElementById('repository-sidebar')
|
||||
const button = repoSideBar?.querySelector(
|
||||
'.tab-bar-item.selected'
|
||||
) as HTMLButtonElement
|
||||
button?.focus()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4829,7 +4838,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
|
|||
// Make sure we show the changes after undoing the commit
|
||||
await this._changeRepositorySection(
|
||||
repository,
|
||||
RepositorySectionTab.Changes
|
||||
RepositorySectionTab.Changes,
|
||||
true
|
||||
)
|
||||
|
||||
await gitStore.undoCommit(commit)
|
||||
|
|
Loading…
Reference in a new issue