Additional key checks for browser compatibility (#2539)
Not all browsers recognize e.key === 'Escape'; some use 'Esc' and some only respond to the keyCode.
This commit is contained in:
		
							parent
							
								
									ad3a6badb4
								
							
						
					
					
						commit
						4d4d71cd67
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		|  | @ -22,7 +22,8 @@ class ModalRoot extends React.PureComponent { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   handleKeyUp (e) { |   handleKeyUp (e) { | ||||||
|     if (e.key === 'Escape' && !!this.props.type) { |     if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27) | ||||||
|  |          && !!this.props.type) { | ||||||
|       this.props.onClose(); |       this.props.onClose(); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue