@radix-ui/react-roving-focus
Advanced tools
Comparing version 1.0.5-rc.6 to 1.0.5-rc.7
@@ -32,2 +32,3 @@ import * as React from "react"; | ||
onEntryFocus?: (event: Event) => void; | ||
preventScrollOnEntryFocus?: boolean; | ||
} | ||
@@ -34,0 +35,0 @@ type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>; |
@@ -62,3 +62,3 @@ var $9QJ9Y$babelruntimehelpersextends = require("@babel/runtime/helpers/extends"); | ||
/* -----------------------------------------------------------------------------------------------*/ const $0063afae63b3fa70$var$RovingFocusGroupImpl = /*#__PURE__*/ $9QJ9Y$react.forwardRef((props, forwardedRef)=>{ | ||
const { __scopeRovingFocusGroup: __scopeRovingFocusGroup , orientation: orientation , loop: loop = false , dir: dir , currentTabStopId: currentTabStopIdProp , defaultCurrentTabStopId: defaultCurrentTabStopId , onCurrentTabStopIdChange: onCurrentTabStopIdChange , onEntryFocus: onEntryFocus , ...groupProps } = props; | ||
const { __scopeRovingFocusGroup: __scopeRovingFocusGroup , orientation: orientation , loop: loop = false , dir: dir , currentTabStopId: currentTabStopIdProp , defaultCurrentTabStopId: defaultCurrentTabStopId , onCurrentTabStopIdChange: onCurrentTabStopIdChange , onEntryFocus: onEntryFocus , preventScrollOnEntryFocus: preventScrollOnEntryFocus = false , ...groupProps } = props; | ||
const ref = $9QJ9Y$react.useRef(null); | ||
@@ -140,3 +140,3 @@ const composedRefs = $9QJ9Y$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref); | ||
); | ||
$0063afae63b3fa70$var$focusFirst(candidateNodes); | ||
$0063afae63b3fa70$var$focusFirst(candidateNodes, preventScrollOnEntryFocus); | ||
} | ||
@@ -249,3 +249,3 @@ } | ||
} | ||
function $0063afae63b3fa70$var$focusFirst(candidates) { | ||
function $0063afae63b3fa70$var$focusFirst(candidates, preventScroll = false) { | ||
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement; | ||
@@ -255,3 +255,5 @@ for (const candidate of candidates){ | ||
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return; | ||
candidate.focus(); | ||
candidate.focus({ | ||
preventScroll: preventScroll | ||
}); | ||
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return; | ||
@@ -258,0 +260,0 @@ } |
{ | ||
"name": "@radix-ui/react-roving-focus", | ||
"version": "1.0.5-rc.6", | ||
"version": "1.0.5-rc.7", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
84211
544