File tree 4 files changed +11
-4
lines changed
packages/@headlessui-react/src/components
4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -1685,6 +1685,7 @@ function OptionsFn<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(
1685
1685
actions . setOptionsElement ,
1686
1686
setLocalOptionsElement
1687
1687
)
1688
+ let portalOwnerDocument = useOwnerDocument ( data . buttonElement || data . inputElement )
1688
1689
let ownerDocument = useOwnerDocument ( data . optionsElement )
1689
1690
1690
1691
let usesOpenClosedState = useOpenClosed ( )
@@ -1819,7 +1820,7 @@ function OptionsFn<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(
1819
1820
let render = useRender ( )
1820
1821
1821
1822
return (
1822
- < Portal enabled = { portal ? props . static || visible : false } >
1823
+ < Portal enabled = { portal ? props . static || visible : false } ownerDocument = { portalOwnerDocument } >
1823
1824
< ComboboxDataContext . Provider
1824
1825
value = { data . mode === ValueMode . Multi ? data : { ...data , isSelected } }
1825
1826
>
Original file line number Diff line number Diff line change @@ -951,6 +951,7 @@ function OptionsFn<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(
951
951
let data = useData ( 'Listbox.Options' )
952
952
let actions = useActions ( 'Listbox.Options' )
953
953
954
+ let portalOwnerDocument = useOwnerDocument ( data . buttonElement )
954
955
let ownerDocument = useOwnerDocument ( data . optionsElement )
955
956
956
957
let usesOpenClosedState = useOpenClosed ( )
@@ -1163,7 +1164,7 @@ function OptionsFn<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(
1163
1164
let render = useRender ( )
1164
1165
1165
1166
return (
1166
- < Portal enabled = { portal ? props . static || visible : false } >
1167
+ < Portal enabled = { portal ? props . static || visible : false } ownerDocument = { portalOwnerDocument } >
1167
1168
< ListboxDataContext . Provider
1168
1169
value = { data . mode === ValueMode . Multi ? data : { ...data , isSelected } }
1169
1170
>
Original file line number Diff line number Diff line change @@ -638,6 +638,7 @@ function ItemsFn<TTag extends ElementType = typeof DEFAULT_ITEMS_TAG>(
638
638
useEvent ( ( element ) => dispatch ( { type : ActionTypes . SetItemsElement , element } ) ) ,
639
639
setLocalItemsElement
640
640
)
641
+ let portalOwnerDocument = useOwnerDocument ( state . buttonElement )
641
642
let ownerDocument = useOwnerDocument ( state . itemsElement )
642
643
643
644
// Always enable `portal` functionality, when `anchor` is enabled
@@ -824,7 +825,7 @@ function ItemsFn<TTag extends ElementType = typeof DEFAULT_ITEMS_TAG>(
824
825
let render = useRender ( )
825
826
826
827
return (
827
- < Portal enabled = { portal ? props . static || visible : false } >
828
+ < Portal enabled = { portal ? props . static || visible : false } ownerDocument = { portalOwnerDocument } >
828
829
{ render ( {
829
830
ourProps,
830
831
theirProps,
Original file line number Diff line number Diff line change @@ -888,6 +888,7 @@ function PanelFn<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(
888
888
useEvent ( ( panel ) => dispatch ( { type : ActionTypes . SetPanel , panel } ) ) ,
889
889
setLocalPanelElement
890
890
)
891
+ let portalOwnerDocument = useOwnerDocument ( state . button )
891
892
let ownerDocument = useOwnerDocument ( internalPanelRef )
892
893
893
894
useIsoMorphicEffect ( ( ) => {
@@ -1080,7 +1081,10 @@ function PanelFn<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(
1080
1081
< ResetOpenClosedProvider >
1081
1082
< PopoverPanelContext . Provider value = { id } >
1082
1083
< PopoverAPIContext . Provider value = { { close, isPortalled } } >
1083
- < Portal enabled = { portal ? props . static || visible : false } >
1084
+ < Portal
1085
+ enabled = { portal ? props . static || visible : false }
1086
+ ownerDocument = { portalOwnerDocument }
1087
+ >
1084
1088
{ visible && isPortalled && (
1085
1089
< Hidden
1086
1090
id = { beforePanelSentinelId }
You can’t perform that action at this time.
0 commit comments