mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
close modal dialog only on Esc button
This commit is contained in:
parent
d6a2e9be3d
commit
c231a648e8
1 changed files with 1 additions and 1 deletions
|
|
@ -36,7 +36,7 @@ const ModalDialog = ({ className, title, buttons, children, dataset, onCloseRequ
|
|||
React.useEffect(() => {
|
||||
const onWindowKeyDown = (event) => {
|
||||
// its `-2` because focus lock render locking divs around its content
|
||||
if (modalsContainer.childNodes[modalsContainer.childElementCount - 2] === modalContainerRef.current) {
|
||||
if (event.key === 'Escape' && modalsContainer.childNodes[modalsContainer.childElementCount - 2] === modalContainerRef.current) {
|
||||
if (typeof onCloseRequest === 'function') {
|
||||
onCloseRequest({
|
||||
type: 'close',
|
||||
|
|
|
|||
Loading…
Reference in a new issue