ui icon indicating copy to clipboard operation
ui copied to clipboard

[bug]: Wrong selector for select component placeholder

Open yudyananda opened this issue 1 year ago • 5 comments

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

  • [X] I've made research efforts and searched the documentation
  • [X] I've searched for existing issues

yudyananda avatar May 14 '24 01:05 yudyananda

@yudyananda Can you please share any codesandbox?

erashu212 avatar May 14 '24 14:05 erashu212

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 avatar May 15 '24 04:05 servesh-chaturvedi

@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

abeisleem avatar May 15 '24 12:05 abeisleem

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

yudyananda avatar May 16 '24 12:05 yudyananda

Why not merged yet?

adham618 avatar Oct 02 '24 16:10 adham618