File tree Expand file tree Collapse file tree 1 file changed +24
-9
lines changed
Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -288,16 +288,31 @@ export default class ModalPortal extends Component {
288288 ) ;
289289 } ;
290290
291- handleKeyDown = event => {
292- if ( isTabKey ( event ) ) {
293- scopeTab ( this . content , event ) ;
294- }
291+ handleKeyDown = event => {
292+ if ( isTabKey ( event ) ) {
293+ scopeTab ( this . content , event ) ;
294+ }
295+
296+ if ( ! this . props . shouldCloseOnEsc ) {
297+ return ;
298+ }
299+
300+ const nativeEvent = event . nativeEvent || event ;
301+
302+ const isComposing =
303+ nativeEvent . isComposing === true ||
304+ nativeEvent . keyCode === 229 ||
305+ nativeEvent . code === "Process" ;
306+
307+ if ( isComposing ) {
308+ return ;
309+ }
310+ if ( isEscKey ( event ) ) {
311+ event . stopPropagation ( ) ;
312+ this . requestClose ( event ) ;
313+ }
314+ } ;
295315
296- if ( this . props . shouldCloseOnEsc && isEscKey ( event ) ) {
297- event . stopPropagation ( ) ;
298- this . requestClose ( event ) ;
299- }
300- } ;
301316
302317 handleOverlayOnClick = event => {
303318 if ( this . shouldClose === null ) {
You can’t perform that action at this time.
0 commit comments