From 186e91b811017ce7fb843435c7ca9b1405b2faf5 Mon Sep 17 00:00:00 2001 From: navedqb Date: Wed, 15 Nov 2023 23:47:20 +0530 Subject: [PATCH] Improve focusable element handling --- components/lib/focustrap/FocusTrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lib/focustrap/FocusTrap.js b/components/lib/focustrap/FocusTrap.js index f9961a9b0..0c9968906 100644 --- a/components/lib/focustrap/FocusTrap.js +++ b/components/lib/focustrap/FocusTrap.js @@ -40,7 +40,7 @@ const FocusTrap = BaseFocusTrap.extend('focustrap', { : DomHandler.getFirstFocusableElement(el, this.getComputedSelector(el.$_pfocustrap_focusableselector)) : DomHandler.getFirstFocusableElement(_el); - return ObjectUtils.isNotEmpty(focusableElement) ? focusableElement : findNextFocusableElement(_el.nextSibling); + return ObjectUtils.isNotEmpty(focusableElement) ? focusableElement : _el.nextSibling ? findNextFocusableElement(_el.nextSibling) : null; }; DomHandler.focus(findNextFocusableElement(mutation.nextSibling));