From 8764814a1994efdfcb5894ee943db949a8b8ba71 Mon Sep 17 00:00:00 2001 From: navedqb <109583873+navedqb@users.noreply.github.com> Date: Thu, 16 Nov 2023 00:00:43 +0530 Subject: [PATCH] Refactor: Improve error 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 0c9968906..44f984449 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 : _el.nextSibling ? findNextFocusableElement(_el.nextSibling) : null; + return ObjectUtils.isNotEmpty(focusableElement) ? focusableElement : _el.nextSibling && findNextFocusableElement(_el.nextSibling); }; DomHandler.focus(findNextFocusableElement(mutation.nextSibling));