File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -318,7 +318,6 @@ export class FilterChangesList extends React.Component<
318318> {
319319 private filterTextBox : TextBox | undefined = undefined
320320 private headerRef = createObservableRef < HTMLDivElement > ( )
321- private filterOptionsButtonRef : HTMLButtonElement | null = null
322321 private includeAllCheckBoxRef = React . createRef < Checkbox > ( )
323322 private filterListRef =
324323 React . createRef < AugmentedSectionFilterList < IChangesListItem > > ( )
@@ -1290,12 +1289,7 @@ export class FilterChangesList extends React.Component<
12901289 }
12911290
12921291 public focus ( ) {
1293- if ( this . props . showChangesFilter ) {
1294- this . filterOptionsButtonRef ?. focus ( )
1295- return
1296- }
1297-
1298- this . includeAllCheckBoxRef . current ?. focus ( )
1292+ this . filterListRef . current ?. focus ( )
12991293 }
13001294
13011295 private onChangedFileClick = (
Original file line number Diff line number Diff line change @@ -402,6 +402,10 @@ export class AugmentedSectionFilterList<
402402 )
403403 }
404404
405+ public focus ( ) {
406+ this . list ?. focus ( )
407+ }
408+
405409 public selectNextItem (
406410 focus : boolean = false ,
407411 inDirection : SelectionDirection = 'down'
Original file line number Diff line number Diff line change @@ -1768,7 +1768,18 @@ export class SectionList extends React.Component<
17681768 lastSelectedRow !== undefined &&
17691769 isValidRow ( lastSelectedRow , rowCount )
17701770 ) {
1771- this . scrollRowToVisible ( lastSelectedRow )
1771+ const rowElement = this . rowRefs . get ( lastSelectedRow )
1772+ if ( rowElement !== undefined ) {
1773+ this . focusRow = lastSelectedRow
1774+ rowElement . focus ( { preventScroll : true } )
1775+ } else {
1776+ // Selected row is not yet materialized in the DOM (virtualized away).
1777+ // Fall back to the first row to avoid a no-focus state.
1778+ const firstRow : RowIndexPath = { section : 0 , row : 0 }
1779+ if ( isValidRow ( firstRow , rowCount ) ) {
1780+ this . scrollRowToVisible ( firstRow )
1781+ }
1782+ }
17721783 } else {
17731784 // TODO: decide which grid to focus
17741785 // if (this.grid) {
Original file line number Diff line number Diff line change @@ -852,6 +852,10 @@ export class RepositoryView extends React.Component<
852852 this . props . repository ,
853853 section
854854 )
855+
856+ if ( section === RepositorySectionTab . Changes ) {
857+ this . focusChangesNeeded = true
858+ }
855859 }
856860
857861 private onTabClicked = ( tab : Tab ) => {
@@ -861,6 +865,9 @@ export class RepositoryView extends React.Component<
861865 this . props . repository ,
862866 section
863867 )
868+ if ( section === RepositorySectionTab . Changes ) {
869+ this . focusChangesNeeded = true
870+ }
864871 if ( ! ! section ) {
865872 this . props . dispatcher . updateCompareForm ( this . props . repository , {
866873 filterText : '' ,
You can’t perform that action at this time.
0 commit comments