File tree 1 file changed +4
-1
lines changed
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -135,23 +135,26 @@ export class Materialbox extends Component<MaterialboxOptions> {
135
135
136
136
private _removeEventHandlers ( ) {
137
137
this . el . removeEventListener ( 'click' , this . _handleMaterialboxClick ) ;
138
+ this . el . removeEventListener ( 'keypress' , this . _handleMaterialboxKeypress ) ;
138
139
}
139
140
140
141
private _handleMaterialboxClick = ( ) => {
141
142
this . _handleMaterialboxToggle ( ) ;
142
143
} ;
144
+
143
145
private _handleMaterialboxKeypress = ( e : KeyboardEvent ) => {
144
146
if ( Utils . keys . ENTER . includes ( e . key ) ) {
145
147
this . _handleMaterialboxToggle ( ) ;
146
148
}
147
149
} ;
150
+
148
151
private _handleMaterialboxToggle = ( ) => {
149
152
// If already modal, return to original
150
153
if ( this . doneAnimating === false || ( this . overlayActive && this . doneAnimating ) )
151
154
this . close ( ) ;
152
155
else
153
156
this . open ( ) ;
154
- }
157
+ } ;
155
158
156
159
private _handleWindowScroll = ( ) => {
157
160
if ( this . overlayActive ) this . close ( ) ;
You can’t perform that action at this time.
0 commit comments