@clayui/shared
Advanced tools
Comparing version 3.78.3 to 3.79.0
@@ -13,13 +13,14 @@ /** | ||
export { LinkOrButton } from './LinkOrButton'; | ||
export { MouseSafeArea } from './MouseSafeArea'; | ||
export { observeRect } from './observeRect'; | ||
export { setElementFullHeight } from './setElementFullHeight'; | ||
export { sub } from './sub'; | ||
export { observeRect } from './observeRect'; | ||
export { useId } from './useId'; | ||
export { useDebounce } from './useDebounce'; | ||
export { useFocusManagement, FOCUSABLE_ELEMENTS } from './useFocusManagement'; | ||
export { setElementFullHeight } from './setElementFullHeight'; | ||
export { useId } from './useId'; | ||
export { useInteractionFocus } from './useInteractionFocus'; | ||
export { useInternalState } from './useInternalState'; | ||
export { useMousePosition } from './useMousePosition'; | ||
export { MouseSafeArea } from './MouseSafeArea'; | ||
export { useInteractionFocus } from './useInteractionFocus'; | ||
export { useNavigation } from './useNavigation'; | ||
export type { IBaseProps as IPortalBaseProps } from './Portal'; | ||
export type { InternalDispatch } from './useInternalState'; |
@@ -115,2 +115,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "useNavigation", { | ||
enumerable: true, | ||
get: function get() { | ||
return _useNavigation.useNavigation; | ||
} | ||
}); | ||
@@ -131,8 +137,10 @@ var _Portal = require("./Portal"); | ||
var _sub = require("./sub"); | ||
var _MouseSafeArea = require("./MouseSafeArea"); | ||
var _observeRect = require("./observeRect"); | ||
var _useId = require("./useId"); | ||
var _setElementFullHeight = require("./setElementFullHeight"); | ||
var _sub = require("./sub"); | ||
var _useDebounce = require("./useDebounce"); | ||
@@ -142,4 +150,6 @@ | ||
var _setElementFullHeight = require("./setElementFullHeight"); | ||
var _useId = require("./useId"); | ||
var _useInteractionFocus = require("./useInteractionFocus"); | ||
var _useInternalState = require("./useInternalState"); | ||
@@ -149,6 +159,4 @@ | ||
var _MouseSafeArea = require("./MouseSafeArea"); | ||
var _useNavigation = require("./useNavigation"); | ||
var _useInteractionFocus = require("./useInteractionFocus"); | ||
/** | ||
@@ -155,0 +163,0 @@ * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com> |
@@ -64,3 +64,5 @@ "use strict"; | ||
var FOCUSABLE_ELEMENTS = ['a[href]', '[contenteditable]', '[tabindex]:not([tabindex^="-"])', 'area[href]', 'button:not([disabled])', 'embed', 'iframe', 'input:not([disabled]):not([type="hidden"])', 'object', 'select:not([disabled]):not([aria-hidden])', 'textarea:not([disabled]):not([aria-hidden])']; | ||
var FOCUSABLE_ELEMENTS = ['a[href]', '[contenteditable]', '[tabindex]:not([tabindex^="-"])', 'area[href]', 'button:not([disabled])', 'embed', 'iframe', 'input:not([disabled]):not([type="hidden"])', 'object', 'select:not([disabled]):not([aria-hidden])', 'textarea:not([disabled]):not([aria-hidden])']; // A switcher that helps define which fiber to use to navigate, the | ||
// component's current fiber or the fiber in progress. | ||
exports.FOCUSABLE_ELEMENTS = FOCUSABLE_ELEMENTS; | ||
@@ -141,9 +143,5 @@ var hasSibling = false; | ||
var getFocusableElementsInScope = function getFocusableElementsInScope(fiberNode) { | ||
var _fiberNode$alternate; | ||
var focusableElements = []; | ||
var child = fiberNode.child; | ||
var _ref2 = !hasSibling ? (_fiberNode$alternate = fiberNode.alternate) !== null && _fiberNode$alternate !== void 0 ? _fiberNode$alternate : fiberNode : fiberNode, | ||
child = _ref2.child; | ||
if (child !== null) { | ||
@@ -162,8 +160,15 @@ collectFocusableElements(child, focusableElements); | ||
var moveFocusInScope = function moveFocusInScope(scope) { | ||
var _scope$alternate; | ||
var backwards = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var persistOnScope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
var fiberFocusElements = getFocusableElementsInScope(scope); | ||
var fiberFocusElements = getFocusableElementsInScope((_scope$alternate = scope.alternate) !== null && _scope$alternate !== void 0 ? _scope$alternate : scope); // When browsing the alternate/in progress fiber if don't find sibling | ||
// elements that might correspond to a React.Portal try searching for | ||
// focusable elements using the current fiber. | ||
if (!hasSibling) { | ||
fiberFocusElements = getFocusableElementsInScope(scope); | ||
} else { | ||
// Just resets the value for the next focus iteration. | ||
hasSibling = false; | ||
} | ||
@@ -170,0 +175,0 @@ |
{ | ||
"name": "@clayui/shared", | ||
"version": "3.78.3", | ||
"version": "3.79.0", | ||
"description": "ClayShared component", | ||
@@ -44,3 +44,3 @@ "license": "BSD-3-Clause", | ||
], | ||
"gitHead": "6066b46f9b7e7455603e9f02e9ebc4f792a619e1" | ||
"gitHead": "4bf7ee4967efc6c2c46aee28b69569f764a1926c" | ||
} |
@@ -88,2 +88,4 @@ /** | ||
// A switcher that helps define which fiber to use to navigate, the | ||
// component's current fiber or the fiber in progress. | ||
let hasSibling = false; | ||
@@ -168,3 +170,3 @@ | ||
const focusableElements: Array<any> = []; | ||
const {child} = !hasSibling ? fiberNode.alternate ?? fiberNode : fiberNode; | ||
const {child} = fiberNode; | ||
@@ -187,6 +189,14 @@ if (child !== null) { | ||
) => { | ||
let fiberFocusElements = getFocusableElementsInScope(scope); | ||
let fiberFocusElements = getFocusableElementsInScope( | ||
scope.alternate ?? scope | ||
); | ||
// When browsing the alternate/in progress fiber if don't find sibling | ||
// elements that might correspond to a React.Portal try searching for | ||
// focusable elements using the current fiber. | ||
if (!hasSibling) { | ||
fiberFocusElements = getFocusableElementsInScope(scope); | ||
} else { | ||
// Just resets the value for the next focus iteration. | ||
hasSibling = false; | ||
} | ||
@@ -193,0 +203,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111830
62
3078