You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using a Popover component and its height increases beyond its internal components and offsets them upwards unless the display property is set to flex or contents or the height is manually set to the height of its contents or less. Here's the Popover component. All the code was copied over directly from the headlessui except I replaced the PopoverButton contents with an SVG component and added a transition to it (also copied from the headlessui website):
I'm fairly certain I tracked the issue down to the Popover component. When I inspect the element, it shows its dimensions as 40x46. However when I set the Popover display to flex the issues goes away (it correctly fits the contents) and the dimensions get set to 40x40 and when I switch the display to contents that also fixes the issues and the dimensions change to auto x auto. When inspecting the element it doesn't show any margin nor padding, but just in case I also tried explicitly setting padding and margin to 0 and the size and height to auto and fit, but none of that fixed the issue.
When I add different background colors to the Popover and UserIcon (and PopoverButton), you can see that it's the Popover element itself with the incorrect height.
Here's a picture showing the initial Popover height issue with it's display property not manually set to anything and the Popover element with a red background and the contents of the PopoverButton with a green background:
Here's a picture showing the Popover height issue fixed with it's display property set to flex:
And here's a picture showing the Popover height issue fixed with it's display property set to contents:
I don't have a screen cap of the PopoverButton background colored but I confirmed that it's the same size as its contents (the UserIcon component). If this issue does happen to be caused by something I have configured on my end or this is expected and intended behavior of the component then my bad, but I don't believe either of those are the case and this could cause potential layout issues for users of the component as it did for me.
The text was updated successfully, but these errors were encountered:
I'm using a Popover component and its height increases beyond its internal components and offsets them upwards unless the display property is set to
flex
orcontents
or the height is manually set to the height of its contents or less. Here's the Popover component. All the code was copied over directly from the headlessui except I replaced the PopoverButton contents with an SVG component and added a transition to it (also copied from the headlessui website):And here's the UserIcon component that's being used for the PopoverButton:
And finally here's the parent component that contains the Popover component:
I'm fairly certain I tracked the issue down to the Popover component. When I inspect the element, it shows its dimensions as
40x46
. However when I set the Popover display toflex
the issues goes away (it correctly fits the contents) and the dimensions get set to40x40
and when I switch the display tocontents
that also fixes the issues and the dimensions change toauto x auto
. When inspecting the element it doesn't show any margin nor padding, but just in case I also tried explicitly setting padding and margin to 0 and the size and height to auto and fit, but none of that fixed the issue.When I add different background colors to the Popover and UserIcon (and PopoverButton), you can see that it's the Popover element itself with the incorrect height.
Here's a picture showing the initial Popover height issue with it's display property not manually set to anything and the Popover element with a red background and the contents of the PopoverButton with a green background:

Here's a picture showing the Popover height issue fixed with it's display property set to

flex
:And here's a picture showing the Popover height issue fixed with it's display property set to

contents
:I don't have a screen cap of the PopoverButton background colored but I confirmed that it's the same size as its contents (the UserIcon component). If this issue does happen to be caused by something I have configured on my end or this is expected and intended behavior of the component then my bad, but I don't believe either of those are the case and this could cause potential layout issues for users of the component as it did for me.
The text was updated successfully, but these errors were encountered: