Skip to content
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

[bug]: Wrong selector for select component placeholder #3737

Open
2 tasks done
yudyananda opened this issue May 14, 2024 · 4 comments
Open
2 tasks done

[bug]: Wrong selector for select component placeholder #3737

yudyananda opened this issue May 14, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@yudyananda
Copy link

Describe the bug

Just found out that tailwind selector placeholder:... on trigger (Select component) won't have any effect. In my casedata-[placeholder] will solve the issue

Affected component/components

Select

How to reproduce

change the style of the trigger placeholder in the select component, and see if there is a change

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

WSL

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@yudyananda yudyananda added the bug Something isn't working label May 14, 2024
@erashu212
Copy link

@yudyananda Can you please share any codesandbox?

@servesh-chaturvedi
Copy link

servesh-chaturvedi commented May 15, 2024

The tailwind placeholder selector is not working for you as the styles will only affect an input/textarea element where placeholder is an attribute. On the select component it is used as a prop so it won't work. @yudyananda

@abeisleem
Copy link

abeisleem commented May 15, 2024

@yudyananda is right. see documentation here: https://www.radix-ui.com/primitives/docs/components/select#with-a-placeholder

currently, the select component is styling the placeholder text with placeholder:text-muted-foreground and based on radix select component, it should be styled with data-[placeholder]:text-muted-foreground. the current placeholder:text-muted-foreground does nothing to the style.

applying the correct placeholder selection has impact on the color of the ChevronDown in making it also text-muted-foreground... to resolve this, it's should color should explicitly be styled with text-foreground

see the following differences:

with the current placeholder selector:
image

with the correct placeholder selector:
image

with the correct placeholder selector AND explicitly styling the color of the chevron:
image


Edit: there's currently an outstanding PR (#2558) for this

@yudyananda
Copy link
Author

The tailwind placeholder selector is not working for you as the styles will only affect an input/textarea element where placeholder is an attribute. On the select component it is used as a prop so it won't work. @yudyananda

@servesh-chaturvedi Yes i'm on the same page with you about that, but just like @abeisleem said the current selector placeholder:... on the select component does nothing because the trigger it self is only a button who act as pseudo element for the hidden input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants