File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ export default class SubMenu extends AbstractMenu {
108108
109109 if ( this . closetimer ) clearTimeout ( this . closetimer ) ;
110110
111- this . unregisterHandlers ( ) ;
111+ this . unregisterHandlers ( true ) ;
112112 }
113113
114114 getMenuPosition = ( ) => {
@@ -212,9 +212,11 @@ export default class SubMenu extends AbstractMenu {
212212 document . addEventListener ( 'keydown' , this . handleKeyNavigation ) ;
213213 }
214214
215- unregisterHandlers = ( ) => {
215+ unregisterHandlers = ( dismounting ) => {
216216 document . removeEventListener ( 'keydown' , this . handleKeyNavigation ) ;
217- document . addEventListener ( 'keydown' , this . props . parentKeyNavigationHandler ) ;
217+ if ( ! dismounting ) {
218+ document . addEventListener ( 'keydown' , this . props . parentKeyNavigationHandler ) ;
219+ }
218220 }
219221
220222 render ( ) {
You can’t perform that action at this time.
0 commit comments