Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/ModalControls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ModalControls: React.FC<ModalPropsWithContext> = (props) => {
<br />
<button
onClick={() => {
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 27 }));
document.dispatchEvent(new KeyboardEvent('keydown', { code: 'Escape' }));
}}
type="button"
>
Expand Down
2 changes: 1 addition & 1 deletion src/ModalProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const ModalProvider: React.FC<ModalProviderProps> = (props) => {
const escIsBound = useRef(false);

const bindEsc = useCallback((e: KeyboardEvent) => {
if (e.keyCode === 27) {
if (e.code === 'Escape') {
dispatchModalState({
type: 'CLOSE_LATEST_MODAL',
})
Expand Down