File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -45,16 +45,6 @@ proto.update = function(graphInfo, buttons) {
45
45
this . element . setAttribute ( 'id' , modeBarId ) ;
46
46
this . element . setAttribute ( 'role' , 'toolbar' ) ;
47
47
this . element . setAttribute ( 'tabindex' , '0' ) ;
48
-
49
- this . element . addEventListener ( 'keydown' , function ( e ) {
50
- if ( e . key === 'Enter' || e . key === ' ' ) {
51
- const activeButton = e . target . closest ( '.modebar-btn' ) ;
52
- if ( activeButton ) {
53
- activeButton . click ( ) ;
54
- e . preventDefault ( ) ;
55
- }
56
- }
57
- } ) ;
58
48
59
49
this . _uid = modeBarId ;
60
50
this . element . className = 'modebar modebar--custom' ;
@@ -191,6 +181,15 @@ proto.createButton = function(config) {
191
181
// only needed for 'hoverClosestGeo' which does not call relayout
192
182
_this . updateActiveButton ( ev . currentTarget ) ;
193
183
} ) ;
184
+ button . addEventListener ( 'keydown' , function ( e ) {
185
+ if ( e . key === 'Enter' || e . key === ' ' ) {
186
+ const activeButton = e . target . closest ( '.modebar-btn' ) ;
187
+ if ( activeButton ) {
188
+ activeButton . click ( ) ;
189
+ e . preventDefault ( ) ;
190
+ }
191
+ }
192
+ } ) ;
194
193
}
195
194
196
195
button . setAttribute ( 'data-toggle' , config . toggle || false ) ;
You can’t perform that action at this time.
0 commit comments