File tree 8 files changed +22
-14
lines changed
arduino-ide-extension/src/browser
8 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -600,7 +600,7 @@ export class BoardsServiceProvider
600
600
boardsConfig . selectedBoard &&
601
601
availableBoards . every ( ( { selected } ) => ! selected )
602
602
) {
603
- let port = boardsConfig . selectedPort
603
+ let port = boardsConfig . selectedPort ;
604
604
// If the selected board has the same port of an unknown board
605
605
// that is already in availableBoards we might get a duplicate port.
606
606
// So we remove the one already in the array and add the selected one.
@@ -611,7 +611,7 @@ export class BoardsServiceProvider
611
611
// get the "Unknown board port" that we will substitute,
612
612
// then we can include it in the "availableBoard object"
613
613
// pushed below; to ensure addressLabel is included
614
- port = availableBoards [ found ] . port
614
+ port = availableBoards [ found ] . port ;
615
615
availableBoards . splice ( found , 1 ) ;
616
616
}
617
617
availableBoards . push ( {
Original file line number Diff line number Diff line change @@ -229,7 +229,7 @@ export namespace UploadSketch {
229
229
id : 'arduino-upload-with-configuration-sketch' ,
230
230
label : nls . localize (
231
231
'arduino/sketch/configureAndUpload' ,
232
- 'Configure And Upload'
232
+ 'Configure and Upload'
233
233
) ,
234
234
category : 'Arduino' ,
235
235
} ;
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ export class UserFields extends Contribution {
58
58
}
59
59
}
60
60
61
- private selectedFqbnAddress ( ) : string | undefined {
61
+ private selectedFqbnAddress ( ) : string | undefined {
62
62
const { boardsConfig } = this . boardsServiceProvider ;
63
63
const fqbn = boardsConfig . selectedBoard ?. fqbn ;
64
64
if ( ! fqbn ) {
@@ -78,7 +78,9 @@ export class UserFields extends Contribution {
78
78
) : Promise < BoardUserField [ ] | undefined > {
79
79
const cached = this . cachedUserFields . get ( key ) ;
80
80
// Deep clone the array of board fields to avoid editing the cached ones
81
- this . userFieldsDialog . value = cached ? cached . slice ( ) : await this . boardsServiceProvider . selectedBoardUserFields ( ) ;
81
+ this . userFieldsDialog . value = cached
82
+ ? cached . slice ( )
83
+ : await this . boardsServiceProvider . selectedBoardUserFields ( ) ;
82
84
const result = await this . userFieldsDialog . open ( ) ;
83
85
if ( ! result ) {
84
86
return ;
@@ -140,10 +142,7 @@ export class UserFields extends Contribution {
140
142
}
141
143
142
144
notifyFailedWithError ( e : Error ) : void {
143
- if (
144
- this . boardRequiresUserFields &&
145
- CoreError . UploadFailed . is ( e )
146
- ) {
145
+ if ( this . boardRequiresUserFields && CoreError . UploadFailed . is ( e ) ) {
147
146
this . userFieldsSet = false ;
148
147
}
149
148
}
Original file line number Diff line number Diff line change @@ -171,6 +171,9 @@ export class UploadCertificateDialog extends AbstractDialog<void> {
171
171
Widget . detach ( this . widget ) ;
172
172
}
173
173
Widget . attach ( this . widget , this . contentNode ) ;
174
+ const firstButton = this . widget . node . querySelector ( 'button' ) ;
175
+ firstButton ?. focus ( ) ;
176
+
174
177
this . widget . busyCallback = this . busyCallback . bind ( this ) ;
175
178
super . onAfterAttach ( msg ) ;
176
179
this . update ( ) ;
Original file line number Diff line number Diff line change @@ -115,6 +115,8 @@ export class UploadFirmwareDialog extends AbstractDialog<void> {
115
115
Widget . detach ( this . widget ) ;
116
116
}
117
117
Widget . attach ( this . widget , this . contentNode ) ;
118
+ const firstButton = this . widget . node . querySelector ( 'button' ) ;
119
+ firstButton ?. focus ( ) ;
118
120
this . widget . busyCallback = this . busyCallback . bind ( this ) ;
119
121
super . onAfterAttach ( msg ) ;
120
122
this . update ( ) ;
Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ export const UserFieldsComponent = ({
16
16
const [ boardUserFields , setBoardUserFields ] = React . useState <
17
17
BoardUserField [ ]
18
18
> ( initialBoardUserFields ) ;
19
-
20
19
const [ uploadButtonDisabled , setUploadButtonDisabled ] =
21
20
React . useState < boolean > ( true ) ;
21
+ const firstInputElement = React . useRef < HTMLInputElement > ( null ) ;
22
22
23
23
React . useEffect ( ( ) => {
24
24
setBoardUserFields ( initialBoardUserFields ) ;
@@ -48,7 +48,10 @@ export const UserFieldsComponent = ({
48
48
React . useEffect ( ( ) => {
49
49
updateUserFields ( boardUserFields ) ;
50
50
setUploadButtonDisabled ( ! allFieldsHaveValues ( boardUserFields ) ) ;
51
- } , [ boardUserFields ] ) ;
51
+ if ( firstInputElement . current ) {
52
+ firstInputElement . current . focus ( ) ;
53
+ }
54
+ } , [ boardUserFields , updateUserFields ] ) ;
52
55
53
56
return (
54
57
< div >
@@ -71,6 +74,7 @@ export const UserFieldsComponent = ({
71
74
field . label
72
75
) }
73
76
onChange = { updateUserField ( index ) }
77
+ ref = { index === 0 ? firstInputElement : undefined }
74
78
/>
75
79
</ div >
76
80
</ div >
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import { BoardUserField } from '../../../common/protocol';
13
13
14
14
@injectable ( )
15
15
export class UserFieldsDialogWidget extends ReactWidget {
16
- protected _currentUserFields : BoardUserField [ ] = [ ] ;
16
+ private _currentUserFields : BoardUserField [ ] = [ ] ;
17
17
18
18
constructor ( private cancel : ( ) => void , private accept : ( ) => Promise < void > ) {
19
19
super ( ) ;
@@ -34,7 +34,7 @@ export class UserFieldsDialogWidget extends ReactWidget {
34
34
} ) ;
35
35
}
36
36
37
- protected setUserFields ( userFields : BoardUserField [ ] ) : void {
37
+ private setUserFields ( userFields : BoardUserField [ ] ) : void {
38
38
this . _currentUserFields = userFields ;
39
39
}
40
40
Original file line number Diff line number Diff line change 376
376
"cantOpen" : " A folder named \" {0}\" already exists. Can't open sketch." ,
377
377
"close" : " Are you sure you want to close the sketch?" ,
378
378
"compile" : " Compiling sketch..." ,
379
- "configureAndUpload" : " Configure And Upload" ,
379
+ "configureAndUpload" : " Configure and Upload" ,
380
380
"createdArchive" : " Created archive '{0}'." ,
381
381
"doneCompiling" : " Done compiling." ,
382
382
"doneUploading" : " Done uploading." ,
You can’t perform that action at this time.
0 commit comments