1
1
import { useSafeLayoutEffect } from '@clerk/shared/react/index' ;
2
- import type { UseDismissProps , UseFloatingOptions } from '@floating-ui/react' ;
2
+ import type { UseDismissProps , UseFloatingOptions , UseRoleProps } from '@floating-ui/react' ;
3
3
import {
4
4
FloatingFocusManager ,
5
5
FloatingPortal ,
@@ -411,10 +411,11 @@ interface ConfirmationProps {
411
411
onOpenChange : ( open : boolean ) => void ;
412
412
children : React . ReactNode ;
413
413
actionsSlot : React . ReactNode ;
414
+ roleProps ?: UseRoleProps ;
414
415
}
415
416
416
417
const Confirmation = React . forwardRef < HTMLDivElement , ConfirmationProps > (
417
- ( { open, onOpenChange, children, actionsSlot } , ref ) => {
418
+ ( { open, onOpenChange, children, actionsSlot, roleProps } , ref ) => {
418
419
const prefersReducedMotion = usePrefersReducedMotion ( ) ;
419
420
const { animations : layoutAnimations } = useAppearance ( ) . parsedLayout ;
420
421
const isMotionSafe = ! prefersReducedMotion && layoutAnimations === true ;
@@ -425,6 +426,11 @@ const Confirmation = React.forwardRef<HTMLDivElement, ConfirmationProps>(
425
426
transform : false ,
426
427
strategy : 'absolute' ,
427
428
} ) ;
429
+ const { getFloatingProps } = useInteractions ( [
430
+ useClick ( context ) ,
431
+ useDismiss ( context ) ,
432
+ useRole ( context , { role : 'alertdialog' , ...roleProps } ) ,
433
+ ] ) ;
428
434
429
435
const mergedRefs = useMergeRefs ( [ ref , refs . setFloating ] ) ;
430
436
@@ -450,8 +456,6 @@ const Confirmation = React.forwardRef<HTMLDivElement, ConfirmationProps>(
450
456
duration : isMotionSafe ? transitionDurationValues . drawer : 0 ,
451
457
} ) ;
452
458
453
- const { getFloatingProps } = useInteractions ( [ useClick ( context ) , useDismiss ( context ) , useRole ( context ) ] ) ;
454
-
455
459
if ( ! isMounted ) return null ;
456
460
457
461
return (
@@ -471,7 +475,6 @@ const Confirmation = React.forwardRef<HTMLDivElement, ConfirmationProps>(
471
475
modal
472
476
outsideElementsInert
473
477
initialFocus = { refs . floating }
474
- visuallyHiddenDismiss
475
478
>
476
479
< Box
477
480
ref = { mergedRefs }
0 commit comments