Use parentElement instead of parent when setting focus for modals with tabs (#16257)

* added null checker for umb-tab when it's trying to get the elm.parent

* use parentElement instead of parent
This commit is contained in:
Vlael Layug
2024-06-22 20:01:04 +08:00
committed by GitHub
parent b60665d096
commit 4e746d367e

View File

@@ -126,7 +126,7 @@
else if(defaultFocusedElement === null ){
// If the first focusable elements are either items from the umb-sub-views-nav menu or the umb-button-ellipsis we most likely want to start the focus on the second item
// We don't want to focus the second button if it's in a tab otherwise the second tab is highlighted as well as the first tab
var avoidStartElm = focusableElements.findIndex(elm => elm.classList.contains('umb-button-ellipsis') || elm.classList.contains('umb-sub-views-nav-item__action') || (elm.classList.contains('umb-tab-button') && !elm.parent.classList.contains('umb-tab')));
var avoidStartElm = focusableElements.findIndex(elm => elm.classList.contains('umb-button-ellipsis') || elm.classList.contains('umb-sub-views-nav-item__action') || (elm.classList.contains('umb-tab-button') && !elm.parentElement.classList.contains('umb-tab')));
if(avoidStartElm === 0) {
focusableElements[1].focus();