ElemeFE / ElemeFE/element-react

Dialog: close modal by pressing ESC don't work

Open
#993 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.8k
Forks
435
PR merge metrics
No merged PRs in 30d

Description

### Description

Can't close Dialog modal by pressing ESC button

### Reproduce Steps

1. Open Dialog [https://elemefe.github.io/element-react/index#/en-US/dialog](url)
2. Try to close it by pressing ESC button

### Solution
It seems like the Refs to that element is not part of the DOM yet when we call componentDidUpdate method.
Adding tabIndex attribute and some delay before setting focus to that modal solve this problem.

![dialog](https://user-images.githubusercontent.com/38039843/58847784-dba3cf80-868c-11e9-9ee4-670592e186b8.JPG)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.