@momentum-design/components 0.134.17 → 0.134.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -605,9 +605,13 @@ class SpatialNavigationProvider extends Provider {
|
|
|
605
605
|
const root = elementWithDataset.getRootNode();
|
|
606
606
|
const nextElement = (_a = root === null || root === void 0 ? void 0 : root.getElementById(nextElementSelector)) !== null && _a !== void 0 ? _a : root === null || root === void 0 ? void 0 : root.querySelector(nextElementSelector);
|
|
607
607
|
if (nextElement) {
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
|
|
608
|
+
const focusableAroundNextElement = findFocusable(nextElement.parentElement, {
|
|
609
|
+
includeSelectors: [`[${DATA_ATTRIBUTES.FOCUSABLE}]`],
|
|
610
|
+
excludeSelectors: [`[${DATA_ATTRIBUTES.EXCLUDE}]`],
|
|
611
|
+
});
|
|
612
|
+
const isNextElementInFocusables = focusableAroundNextElement.includes(nextElement);
|
|
613
|
+
focusableElements = focusableAroundNextElement.filter(el => nextElement.contains(el) && el !== nextElement);
|
|
614
|
+
if (isNextElementInFocusables || focusableElements.length <= 0) {
|
|
611
615
|
// Use nextElement if it focusable
|
|
612
616
|
return nextElement;
|
|
613
617
|
}
|