[BUG] - Autofilled Input styling is incorrect in dark mode
HeroUI Version
2.8.4
Describe the bug
Autofilled input fields are not styled correctly in the dark theme. The issue occurs on desktop Safari and mobile platforms (Chrome / Safari).
LightMode works correctly, just no autofilled style more You may have disabled this native feature. Test on all devices pls. It would be nice to have a configurable option to enable or disable these global native autofill styles. It is important to note that in mobile browsers it is almost impossible to override the styles of auto-filled data.
Your Example Website or App
https://www.heroui.com/docs/components/input#built-in-validation
Steps to Reproduce the Bug or Issue
- Open HeroUI components in Safari (desktop) or Chrome/Safari (mobile).
- Navigate to Input component With Form
- Autofill the input Email using saved email in browser
- Observe the incorrect styling in the dark mode.
Expected behavior
Autofilled input fields should match the dark theme styling consistently native filing
Screenshots or Videos
Operating System Version
Safari version 18.1 (20619.2.8.11.10)
Browser
Safari
Please assign it to me!
UP ⬆️
Hi, any information regarding when a fix will be released?
This was my solution for the time being
Problem: On mobile browsers, autofilled HeroUI Input components don't apply proper theme styling (dark mode text appears incorrectly styled).
Root Cause: While HeroUI's onValueChange fires during mobile autofill, the component's internal styling state doesn't update to reflect the "filled" state.
Solution: Force component remount when values change during autofill.
// 1. Add a render key state const [renderKey, setRenderKey] = useState(0);
// 2. Increment key in your change handler const handleInputChange = (value: string) => { setRenderKey(prev => prev + 1); // Forces remount // ... your normal value handling };
// 3. Use key prop on Input component
<Input
key={input-${renderKey}}
value={value}
onValueChange={handleInputChange}
// ... other props
/>
How it works: When autofill occurs, onValueChange fires → increments render key → React sees key change → completely remounts Input component → HeroUI starts fresh with the filled value and applies proper styling.
Result: Mobile autofill now immediately displays correct theme styling instead of browser's default autofill colors.
Trade-off: Slight performance impact from component remounting, but solves the visual theming issue entirely.