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) {
4545 this . element . setAttribute ( 'id' , modeBarId ) ;
4646 this . element . setAttribute ( 'role' , 'toolbar' ) ;
4747 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- } ) ;
5848
5949 this . _uid = modeBarId ;
6050 this . element . className = 'modebar modebar--custom' ;
@@ -191,6 +181,15 @@ proto.createButton = function(config) {
191181 // only needed for 'hoverClosestGeo' which does not call relayout
192182 _this . updateActiveButton ( ev . currentTarget ) ;
193183 } ) ;
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+ } ) ;
194193 }
195194
196195 button . setAttribute ( 'data-toggle' , config . toggle || false ) ;
You can’t perform that action at this time.
0 commit comments