[BUG] - Use outline instead borders for inputs...
HeroUI Version
2.8.5
Describe the bug
If a container has a padding with an input inside that gets focus its border goes beyond parent container that creates unexpected result...
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
- Create a div container.
- Add padding to the div container.
- Create and insert a from element to the container.
- Insert an input inside the form.
- Focus on the input.
- See the bug
Expected behavior
Padding doesn't affect on any state of any element in any level of nesting
Screenshots or Videos
Operating System Version
macOs
Browser
Chrome
Can you assign the task to me? I'm interested to resolve the bug.
Hi @alyiev,
I've investigated this behavior and would like to clarify a few things. I created a reproduction in Storybook following your exact steps (container with padding → form → input), but I wasn't able to reproduce the border bleeding beyond the parent padding in the default case.
However, I noticed this issue can occur when the parent container or form element has overflow: hidden applied. Could you check if any of your parent elements have this CSS property set?
Technical background:
- HeroUI's
borderedandfadedvariants useborderfor the visual border (which is the correct approach for decorative borders) - Focus rings use
outline(which doesn't affect layout and can render outside the element) - The
borderproperty is part of the box model and should respect parent padding unlessoverflow: hiddenclips it
Could you please provide:
- A CodeSandbox or minimal reproduction that shows the issue?
- Any custom CSS you're applying to the container, form, or input elements?
- Screenshots of the browser DevTools showing the computed styles of the affected elements?
This will help us determine if this is a bug in HeroUI or a CSS configuration issue. Thank you!
closing due to inactivity