Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic4 ion-select placeholder opacity can't be change

Not able to change placeholder opacity in ionic v4

i have tried to change opacity of ion-select placeholder in global.css

following is my code

.select-placeholder {
opacity: 1 ; }

but that didn't works , even i tried all methods to change it's css like
ion-select{
        --placeholder-opacity: 1 !important;
    }
    ion-select{
         --opacity: 1 !important;
    }
    ion-select{
        opacity: 1 !important;
    }
etc... but not works fine , event it color change very well using following code 
   ion-select{
         color: var(--ion-color-secondary);
    }
no change , it took default opacity <style> tag.

Any help would be appreciated

Edited

<ion-select class="contact-us-select" interface="alert" [interfaceOptions]="customPopoverOptions"
        placeholder="selection" cancelText="cancel" okText="done" (ionChange)="onSelectChangevalue($event)">
        <ion-select-option *ngFor="let item of Data" [value]="item.id">{{item?.title}}</ion-select-option>
      </ion-select>
like image 626
paras shah Avatar asked May 09 '19 08:05

paras shah


1 Answers

I'm afraid that's a bug of Ionic 4 (still happening in Ionic 4.4 as you can see in these github issues: 17446, 17166 and 17248).

Unfortunately, since you cannot access directly to the shadow DOM to change that value, there's no much we can do to fix the issue for now.

One of the users suggested using a label as a workaround (here) or even modifying a file from the node modules folder (here) but I guess a better workaround would be to preselect the first value by default. So for example if the options are Phone, Email, Live Chat, instead of showing the placeholder, you could preselect Phone by default until this bug is fixed in Ionic's core.

like image 147
sebaferreras Avatar answered Sep 20 '22 02:09

sebaferreras