mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 11:42: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(() => {
|
React.useEffect(() => {
|
||||||
const onWindowKeyDown = (event) => {
|
const onWindowKeyDown = (event) => {
|
||||||
// its `-2` because focus lock render locking divs around its content
|
// 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') {
|
if (typeof onCloseRequest === 'function') {
|
||||||
onCloseRequest({
|
onCloseRequest({
|
||||||
type: 'close',
|
type: 'close',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue