From 2f43c1c06a326e0458756b643d79edcf7210e25f Mon Sep 17 00:00:00 2001 From: John Coburn Date: Wed, 13 Nov 2024 08:25:26 -0600 Subject: [PATCH] assign modal escape key handler to modal element rather than document (#2389) --- CHANGELOG.md | 1 + lib/Modal/WrappingElement.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3dbe424a..63bf14b5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * Bump `stripes-react-hotkeys` to `v3.2.0` for compatibility with `findDOMNode()` changes. STCOM-1343. * Pin `currency-codes` to `v2.1.0` to avoid duplicate entries in `v2.2.0`. Refs STCOM-1379. * Wrap `` in full-width div. Refs STCOM-1332. +* Assign ``'s exit key handler to Modal's element rather than `document`. refs STCOM-1382. ## [12.2.0](https://github.com/folio-org/stripes-components/tree/v12.2.0) (2024-10-11) [Full Changelog](https://github.com/folio-org/stripes-components/compare/v12.1.0...v12.2.0) diff --git a/lib/Modal/WrappingElement.js b/lib/Modal/WrappingElement.js index a9b436b99..535e9e9e1 100644 --- a/lib/Modal/WrappingElement.js +++ b/lib/Modal/WrappingElement.js @@ -123,7 +123,7 @@ const WrappingElement = forwardRef(({ focusTrapRef.current.activate(); ATTrap.apply(); } - keyDownHandlerRef.current = listen(document, 'keydown', keyDownHandler); + keyDownHandlerRef.current = listen(modalElementRef.current, 'keydown', keyDownHandler); focusHandlerRef.current = listen(document, 'focus', enforceFocusTimeout, true); onOpen(); }