File tree Expand file tree Collapse file tree
src/vs/base/browser/ui/dialog Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,6 +99,14 @@ export class Dialog extends Disposable {
9999 let focusedButton = 0 ;
100100 const buttonGroup = this . buttonGroup = new ButtonGroup ( this . buttonsContainer , this . buttons . length , { title : true } ) ;
101101 const buttonMap = this . rearrangeButtons ( this . buttons , this . options . cancelId ) ;
102+
103+ // Set focused button to UI index
104+ buttonMap . forEach ( ( value , index ) => {
105+ if ( value . index === 0 ) {
106+ focusedButton = index ;
107+ }
108+ } ) ;
109+
102110 buttonGroup . buttons . forEach ( ( button , index ) => {
103111 button . label = mnemonicButtonLabel ( buttonMap [ index ] . label , true ) ;
104112
@@ -190,11 +198,7 @@ export class Dialog extends Disposable {
190198 show ( this . element ) ;
191199
192200 // Focus first element
193- buttonMap . forEach ( ( value , index ) => {
194- if ( value . index === focusedButton ) {
195- buttonGroup . buttons [ index ] . focus ( ) ;
196- }
197- } ) ;
201+ buttonGroup . buttons [ focusedButton ] . focus ( ) ;
198202 } ) ;
199203 }
200204
You can’t perform that action at this time.
0 commit comments