Repository navigation
feat: FocusScope custom restore focus target - #10962
Open
snowystinger wants to merge 1 commit into
Open
snowystinger wants to merge 1 commit into
snowystinger wants to merge 1 commit into
Conversation
3 of 7 tasks
|
Build successful! 🎉 |
## API Changes
react-aria-components/react-aria-components:Modal Modal {
children?: ChildrenOrFunction<ModalRenderProps>
className?: ClassNameOrFunction<ModalRenderProps> = 'react-aria-ModalOverlay'
defaultOpen?: boolean
isDismissable?: boolean = false
isEntering?: boolean
isExiting?: boolean
isKeyboardDismissDisabled?: boolean = false
isOpen?: boolean
onEnter?: (HTMLElement) => void | Promise<void>
onExit?: (HTMLElement) => void | Promise<void>
onOpenChange?: (boolean) => void
render?: DOMRenderFunction<keyof React.JSX.IntrinsicElements, ModalRenderProps>
+ restoreFocus?: OverlayProps['restoreFocus'] = true
shouldCloseOnInteractOutside?: (Element) => boolean
slot?: string | null
style?: StyleOrFunction<ModalRenderProps>
}/react-aria-components:ModalOverlay ModalOverlay {
children?: ChildrenOrFunction<ModalRenderProps>
className?: ClassNameOrFunction<ModalRenderProps> = 'react-aria-ModalOverlay'
defaultOpen?: boolean
isDismissable?: boolean = false
isEntering?: boolean
isExiting?: boolean
isKeyboardDismissDisabled?: boolean = false
isOpen?: boolean
onEnter?: (HTMLElement) => void | Promise<void>
onExit?: (HTMLElement) => void | Promise<void>
onOpenChange?: (boolean) => void
render?: DOMRenderFunction<keyof React.JSX.IntrinsicElements, ModalRenderProps>
+ restoreFocus?: OverlayProps['restoreFocus'] = true
shouldCloseOnInteractOutside?: (Element) => boolean
slot?: string | null
style?: StyleOrFunction<ModalRenderProps>
}/react-aria-components:Popover Popover {
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
arrowBoundaryOffset?: number = 0
arrowRef?: RefObject<Element | null>
boundaryElement?: Element = document.body
children?: ChildrenOrFunction<PopoverRenderProps>
className?: ClassNameOrFunction<PopoverRenderProps> = 'react-aria-Popover'
containerPadding?: number = 12
crossOffset?: number = 0
defaultOpen?: boolean
getTargetRect?: (Element) => DOMRectReadOnly | null | undefined = target.getBoundingClientRect()
isEntering?: boolean
isExiting?: boolean
isKeyboardDismissDisabled?: boolean = false
isNonModal?: boolean
isOpen?: boolean
maxHeight?: number
offset?: number = 8
onBlurWithin?: (FocusEvent) => void
onFocusWithin?: (FocusEvent) => void
onFocusWithinChange?: (boolean) => void
onOpenChange?: (boolean) => void
placement?: Placement = 'bottom'
render?: DOMRenderFunction<keyof React.JSX.IntrinsicElements, PopoverRenderProps>
+ restoreFocus?: OverlayProps['restoreFocus'] = true
scrollRef?: RefObject<Element | null> = overlayRef
shouldCloseOnInteractOutside?: (Element) => boolean
shouldFlip?: boolean = true
shouldSkipAnimation?: boolean
slot?: string | null
style?: StyleOrFunction<PopoverRenderProps>
trigger?: string
triggerRef?: RefObject<Element | null>
}/react-aria-components:SheetOverlay SheetOverlay {
children?: ChildrenOrFunction<SheetRenderProps>
className?: ClassNameOrFunction<SheetRenderProps> = 'react-aria-SheetOverlay'
defaultOpen?: boolean
isOpen?: boolean
onOpenChange?: (boolean) => void
position?: 'bottom' | 'top' | 'left' | 'right' | 'start' | 'end' | 'center' = 'bottom'
preventDismissal?: boolean = false
render?: DOMRenderFunction<keyof React.JSX.IntrinsicElements, SheetRenderProps>
+ restoreFocus?: OverlayProps['restoreFocus'] = true
shouldCloseOnInteractOutside?: (Element) => boolean
slot?: string | null
snapPoints?: Array<number | string>
style?: StyleOrFunction<SheetRenderProps>
}/react-aria-components:Sheet Sheet {
children?: ChildrenOrFunction<SheetRenderProps>
className?: ClassNameOrFunction<SheetRenderProps> = 'react-aria-Sheet'
overscrollPadding?: boolean
render?: DOMRenderFunction<keyof React.JSX.IntrinsicElements, SheetRenderProps>
+ restoreFocus?: OverlayProps['restoreFocus'] = true
slot?: string | null
stackAnimation?: string
style?: StyleOrFunction<SheetRenderProps>
swipeAnimation?: string
start?: number
end?: number
}
}/react-aria-components:ModalOverlayProps ModalOverlayProps {
children?: ChildrenOrFunction<ModalRenderProps>
className?: ClassNameOrFunction<ModalRenderProps> = 'react-aria-ModalOverlay'
defaultOpen?: boolean
isDismissable?: boolean = false
isEntering?: boolean
isExiting?: boolean
isKeyboardDismissDisabled?: boolean = false
isOpen?: boolean
onEnter?: (HTMLElement) => void | Promise<void>
onExit?: (HTMLElement) => void | Promise<void>
onOpenChange?: (boolean) => void
render?: DOMRenderFunction<keyof React.JSX.IntrinsicElements, ModalRenderProps>
+ restoreFocus?: OverlayProps['restoreFocus'] = true
shouldCloseOnInteractOutside?: (Element) => boolean
slot?: string | null
style?: StyleOrFunction<ModalRenderProps>
}/react-aria-components:PopoverProps PopoverProps {
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
arrowBoundaryOffset?: number = 0
arrowRef?: RefObject<Element | null>
boundaryElement?: Element = document.body
children?: ChildrenOrFunction<PopoverRenderProps>
className?: ClassNameOrFunction<PopoverRenderProps> = 'react-aria-Popover'
containerPadding?: number = 12
crossOffset?: number = 0
defaultOpen?: boolean
getTargetRect?: (Element) => DOMRectReadOnly | null | undefined = target.getBoundingClientRect()
isEntering?: boolean
isExiting?: boolean
isKeyboardDismissDisabled?: boolean = false
isNonModal?: boolean
isOpen?: boolean
maxHeight?: number
offset?: number = 8
onBlurWithin?: (FocusEvent) => void
onFocusWithin?: (FocusEvent) => void
onFocusWithinChange?: (boolean) => void
onOpenChange?: (boolean) => void
placement?: Placement = 'bottom'
render?: DOMRenderFunction<keyof React.JSX.IntrinsicElements, PopoverRenderProps>
+ restoreFocus?: OverlayProps['restoreFocus'] = true
scrollRef?: RefObject<Element | null> = overlayRef
shouldCloseOnInteractOutside?: (Element) => boolean
shouldFlip?: boolean = true
shouldSkipAnimation?: boolean
slot?: string | null
style?: StyleOrFunction<PopoverRenderProps>
trigger?: string
triggerRef?: RefObject<Element | null>
}/react-aria-components:SheetOverlayProps SheetOverlayProps {
children?: ChildrenOrFunction<SheetRenderProps>
className?: ClassNameOrFunction<SheetRenderProps> = 'react-aria-SheetOverlay'
defaultOpen?: boolean
isOpen?: boolean
onOpenChange?: (boolean) => void
position?: 'bottom' | 'top' | 'left' | 'right' | 'start' | 'end' | 'center' = 'bottom'
preventDismissal?: boolean = false
render?: DOMRenderFunction<keyof React.JSX.IntrinsicElements, SheetRenderProps>
+ restoreFocus?: OverlayProps['restoreFocus'] = true
shouldCloseOnInteractOutside?: (Element) => boolean
slot?: string | null
snapPoints?: Array<number | string>
style?: StyleOrFunction<SheetRenderProps>
}/react-aria-components:SheetProps SheetProps {
children?: ChildrenOrFunction<SheetRenderProps>
className?: ClassNameOrFunction<SheetRenderProps> = 'react-aria-Sheet'
overscrollPadding?: boolean
render?: DOMRenderFunction<keyof React.JSX.IntrinsicElements, SheetRenderProps>
+ restoreFocus?: OverlayProps['restoreFocus'] = true
slot?: string | null
stackAnimation?: string
style?: StyleOrFunction<SheetRenderProps>
swipeAnimation?: string
start?: number
end?: number
}
}@react-aria/focus/@react-aria/focus:FocusScope FocusScope {
autoFocus?: boolean
children: ReactNode
contain?: boolean
- restoreFocus?: boolean
+ restoreFocus?: boolean | RefObject<FocusableElement | null> | (Modality | null) => FocusableElement | boolean | null
}/@react-aria/focus:FocusScopeProps FocusScopeProps {
autoFocus?: boolean
children: ReactNode
contain?: boolean
- restoreFocus?: boolean
+ restoreFocus?: boolean | RefObject<FocusableElement | null> | (Modality | null) => FocusableElement | boolean | null
}@react-aria/overlays/@react-aria/overlays:Overlay Overlay {
children: ReactNode
disableFocusManagement?: boolean
isExiting?: boolean
portalContainer?: Element = document.body
+ restoreFocus?: FocusScopeProps['restoreFocus'] = true
shouldContainFocus?: boolean
}/@react-aria/overlays:OverlayProps OverlayProps {
children: ReactNode
disableFocusManagement?: boolean
isExiting?: boolean
portalContainer?: Element = document.body
+ restoreFocus?: FocusScopeProps['restoreFocus'] = true
shouldContainFocus?: boolean
}@react-spectrum/ai/@react-spectrum/ai:PromptTokenFieldPopoverProps PromptTokenFieldPopoverProps {
UNSAFE_className?: UnsafeClassName
UNSAFE_style?: CSSProperties
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
arrowRef?: RefObject<Element | null>
boundaryElement?: Element = document.body
children?: ChildrenOrFunction<PopoverRenderProps>
containerPadding?: number = 12
crossOffset?: number = 0
defaultOpen?: boolean
filterAnchor?: Position | null
getTargetRect?: (Element) => DOMRectReadOnly | null | undefined = target.getBoundingClientRect()
hideArrow?: boolean = false
isEntering?: boolean
isExiting?: boolean
isFocused?: boolean
isNonModal?: boolean
isOpen?: boolean
items?: Array<React.ReactNode> | null | Promise<Array<React.ReactNode> | null>
maxHeight?: number
menuWidth?: number
offset?: number = 8
onBlurWithin?: (FocusEvent) => void
onFocusWithin?: (FocusEvent) => void
onFocusWithinChange?: (boolean) => void
onOpenChange?: (boolean) => void
placement?: Placement = 'bottom'
+ restoreFocus?: OverlayProps['restoreFocus'] = true
scrollRef?: RefObject<Element | null> = overlayRef
shouldFlip?: boolean = true
size?: 'S' | 'M' | 'L'
slot?: string | null
trigger?: string
triggerRef?: RefObject<Element | null>
}@react-spectrum/s2/@react-spectrum/s2:PopoverProps PopoverProps {
UNSAFE_className?: UnsafeClassName
UNSAFE_style?: CSSProperties
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
arrowRef?: RefObject<Element | null>
boundaryElement?: Element = document.body
children?: ChildrenOrFunction<PopoverRenderProps>
containerPadding?: number = 12
crossOffset?: number = 0
defaultOpen?: boolean
getTargetRect?: (Element) => DOMRectReadOnly | null | undefined = target.getBoundingClientRect()
hideArrow?: boolean = false
isEntering?: boolean
isExiting?: boolean
isNonModal?: boolean
isOpen?: boolean
maxHeight?: number
offset?: number = 8
onBlurWithin?: (FocusEvent) => void
onFocusWithin?: (FocusEvent) => void
onFocusWithinChange?: (boolean) => void
onOpenChange?: (boolean) => void
placement?: Placement = 'bottom'
+ restoreFocus?: OverlayProps['restoreFocus'] = true
scrollRef?: RefObject<Element | null> = overlayRef
shouldFlip?: boolean = true
size?: 'S' | 'M' | 'L'
slot?: string | null
trigger?: string
triggerRef?: RefObject<Element | null>
} |
reidbarber
requested changes
Nov 13, 2026
| * | ||
| * @default true | ||
| */ | ||
| restoreFocus?: OverlayProps['restoreFocus']; |
Member
There was a problem hiding this comment.
Should we omit this from SheetProps?
| * | ||
| * @default true | ||
| */ | ||
| restoreFocus?: OverlayProps['restoreFocus']; |
Member
There was a problem hiding this comment.
Should we omit this from S2's PopoverProps?
| * | ||
| * @default true | ||
| */ | ||
| restoreFocus?: OverlayProps['restoreFocus']; |
Member
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #9876
Taking over #10926 so we can iterate faster before release
Summary
📝 Test Instructions
Release impact
✅ PR Checklist
🧢 Your Project