Skip to content

RadioGroup and CheckboxGroup Add Unexpected Space Below Scrollable Div #7728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jared-christensen opened this issue Feb 6, 2025 · 3 comments

Comments

@jared-christensen
Copy link

jared-christensen commented Feb 6, 2025

Provide a general summary of the issue here

When placing a <RadioGroup> or <CheckboxGroup> inside a div styled with height: 100vh and overflow: auto, an unexpected blank space appears below the div. This space should not exist, and it causes layout issues.

🤔 Expected Behavior?

  • The div should take up exactly the full viewport height (100vh) and should not have any extra space below it.
  • Scrolling should be contained within the div, and no additional whitespace should be added by RadioGroup or CheckboxGroup.

😯 Current Behavior

  • Extra space appears below the div when using RadioGroup or CheckboxGroup.
  • The issue does not happen with standard form elements like or .
  • This causes unintended scrolling behavior when navigating items inside the div.

💁 Possible Solution

If I add position fixed to the HTML tag I can work around it for now.

🔦 Context

This issue makes it difficult to create full-screen, scrollable sections that include RadioGroup or CheckboxGroup. It affects UI consistency and forces developers to find workarounds.

🖥️ Steps to Reproduce

  1. Create a div styled with height: 100vh and overflow: auto.
  2. Place a RadioGroup or CheckboxGroup inside the div.
  3. Notice that extra space appears below the div.

https://www.loom.com/share/f0c32799b3434ef78ed4f01c70cc4c57?sid=50634b85-6899-4abc-bbf8-67c9df8d99c0
https://codesandbox.io/p/sandbox/crazy-voice-rp2y77

Version

"react-aria": "^3.35.1", "react-aria-components": "^1.4.1",

What browsers are you seeing the problem on?

Chrome

If other, please specify.

Edge and Safari

What operating system are you using?

Mac OS 15.3

🧢 Your Company/Team

Dice

🕷 Tracking Issue

No response

@snowystinger
Copy link
Member

I believe this is a duplicate of The VisuallyHidden component from the React Aria library breaks styling under certain conditions can you try the suggestions in that issue and see if that fixes it for you?

@jared-christensen
Copy link
Author

jared-christensen commented Feb 6, 2025

Adding position: relative to the group seems to fix the issue!

@snowystinger
Copy link
Member

Closing and further discussions can happen in the original issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants