Skip to content

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 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 Jul 15, 2025
Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
@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

3 participants