@@ -18,6 +18,7 @@ class Toolbar extends React.Component {
18
18
super ( props ) ;
19
19
this . handleKeyPress = this . handleKeyPress . bind ( this ) ;
20
20
this . handleProjectNameChange = this . handleProjectNameChange . bind ( this ) ;
21
+ this . handleProjectNameClick = this . handleProjectNameClick . bind ( this ) ;
21
22
this . handleProjectNameSave = this . handleProjectNameSave . bind ( this ) ;
22
23
23
24
this . state = {
@@ -36,6 +37,17 @@ class Toolbar extends React.Component {
36
37
this . setState ( { projectNameInputValue : event . target . value } ) ;
37
38
}
38
39
40
+ handleProjectNameClick ( ) {
41
+ if ( this . canEditProjectName ) {
42
+ this . props . showEditProjectName ( ) ;
43
+ setTimeout ( ( ) => {
44
+ if ( this . projectNameInput ) {
45
+ this . projectNameInput . focus ( ) ;
46
+ }
47
+ } , 140 ) ;
48
+ }
49
+ }
50
+
39
51
handleProjectNameSave ( ) {
40
52
const newProjectName = this . state . projectNameInputValue . trim ( ) ;
41
53
if ( newProjectName . length === 0 ) {
@@ -132,12 +144,7 @@ class Toolbar extends React.Component {
132
144
< div className = { nameContainerClass } >
133
145
< button
134
146
className = "toolbar__project-name"
135
- onClick = { ( ) => {
136
- if ( canEditProjectName ) {
137
- this . props . showEditProjectName ( ) ;
138
- setTimeout ( ( ) => this . projectNameInput . focus ( ) , 140 ) ;
139
- }
140
- } }
147
+ onClick = { this . handleProjectNameClick }
141
148
disabled = { ! canEditProjectName }
142
149
aria-label = { this . props . t ( 'Toolbar.EditSketchARIA' ) }
143
150
>
0 commit comments