@lumx/react 3.6.7-alpha.2 → 3.6.7-alpha.4
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.
package/index.js
CHANGED
|
@@ -2680,6 +2680,7 @@ function getFocusableElements(element) {
|
|
|
2680
2680
|
*/
|
|
2681
2681
|
function getFirstAndLastFocusable(parentElement) {
|
|
2682
2682
|
const focusableElements = getFocusableElements(parentElement);
|
|
2683
|
+
console.log('focusableElements', focusableElements);
|
|
2683
2684
|
|
|
2684
2685
|
// First non disabled element.
|
|
2685
2686
|
const first = focusableElements[0];
|
|
@@ -2723,6 +2724,12 @@ function useFocusTrap(focusZoneElement, focusElement) {
|
|
|
2723
2724
|
return;
|
|
2724
2725
|
}
|
|
2725
2726
|
const focusable = getFirstAndLastFocusable(focusZoneElement);
|
|
2727
|
+
console.log('data', {
|
|
2728
|
+
focusable,
|
|
2729
|
+
activeElement: document.activeElement,
|
|
2730
|
+
endOfFocusZone: !evt.shiftKey && document.activeElement === focusable.last,
|
|
2731
|
+
isInFocusZone: focusZoneElement.contains(document.activeElement)
|
|
2732
|
+
});
|
|
2726
2733
|
|
|
2727
2734
|
// Prevent focus switch if no focusable available.
|
|
2728
2735
|
if (!focusable.first) {
|
|
@@ -2736,6 +2743,7 @@ function useFocusTrap(focusZoneElement, focusElement) {
|
|
|
2736
2743
|
!evt.shiftKey && document.activeElement === focusable.last ||
|
|
2737
2744
|
// Previous focus is outside the focus zone
|
|
2738
2745
|
!focusZoneElement.contains(document.activeElement)) {
|
|
2746
|
+
console.log('focus first');
|
|
2739
2747
|
focusable.first.focus();
|
|
2740
2748
|
evt.preventDefault();
|
|
2741
2749
|
return;
|