Skip to content

Center the dropdown icon added to an input with a paired datalist in Chrome #18511

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

Merged
merged 9 commits into from
Jul 15, 2025

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Jul 11, 2025

This PR tweaks the dropdown arrow added to an input by Chrome when it has a list attribute pointing to a <datalist>.

Right now the arrow isn't centered vertically:

Screenshot 2025-07-14 at 15 41 50

The cause of this is the line height being inherited into the pseudo element which controls how the marker is positioned. I think this is because it's being drawn with unicode symbols but I'm not sure. It could just be from the list-item display.

After this PR changes the line height its centered again:

Screenshot 2025-07-14 at 15 42 05

Some notes:

This only affects Chrome and also does not appear to cause issues for date/time inputs. While weird that this pseudo is the one used for a <datalist> marker it is indeed correct.

Fixes #18499

Can use this Play to test the change: https://play.tailwindcss.com/jzT35CRpr0

@thecrypticace thecrypticace requested a review from a team as a code owner July 11, 2025 13:25
@thecrypticace thecrypticace changed the title Center the ::marker added to an input with a paired datalist Center the ::marker added to an input with a paired datalist Jul 11, 2025
This only affects chrome and also does not appear to cause issues for date/time inputs. While weird that this pseudo is the one used for a datalist marker it is indeed correct.
@thecrypticace thecrypticace force-pushed the fix/center-input-datalist-marker-chrome branch from 8947ad2 to b37e12d Compare July 14, 2025 20:26
@thecrypticace thecrypticace changed the title Center the ::marker added to an input with a paired datalist Center the dropdown icon added to an input with a paired datalist in Chrome Jul 15, 2025
Co-authored-by: Jonathan Reinink <[email protected]>
@thecrypticace thecrypticace merged commit 88b9f15 into main Jul 15, 2025
7 checks passed
@thecrypticace thecrypticace deleted the fix/center-input-datalist-marker-chrome branch July 15, 2025 18:41
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

Successfully merging this pull request may close these issues.

datalist marker
2 participants