From 33e5b4df6eea07c895712a985b28088a782fc6f9 Mon Sep 17 00:00:00 2001 From: Juan Cortes Ross Date: Wed, 17 Oct 2018 15:14:03 +0200 Subject: [PATCH] Disable ModalWrap focus grab if lastFocus is inside it already --- src/components/base/Modal/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/base/Modal/index.js b/src/components/base/Modal/index.js index 1601efd3..ca84f4fb 100644 --- a/src/components/base/Modal/index.js +++ b/src/components/base/Modal/index.js @@ -186,8 +186,7 @@ export class Modal extends Component { focusWrapper = () => { // Forced to use findDOMNode here, because innerRef is giving a proxied component const domWrapper = findDOMNode(this._wrapper) // eslint-disable-line react/no-find-dom-node - - if (domWrapper instanceof HTMLDivElement) { + if (domWrapper instanceof HTMLDivElement && !domWrapper.contains(this._lastFocusedElement)) { domWrapper.focus() } }