Hmm, sp-dropdown has a “placeholder” attribute (but that’s going to be deprecated) so I assumed sp-picker would have the “placeholder” attribute also, and, in fact, the “placeholder” attribute does work in the HTML for vanilla JavaScript plugins for the sp-picker elment. The placeholder value is properly displayed on the plugin to let the user know what to do with the picker menu. It’s just programmatically changing it where the failure occurs.
I tried replacing “placeholder” with “label” in the he following HTML. But it fails to even show the “label” value “Choose item…” in the picker menu window before the user selects an item from the picker:
I copied in the code from this page below, and it doesn’t display the label value “Selection type” in the picker menu either.
<sp-picker id="picker-m" size="m" label="Selection type">
<sp-menu-item>Deselect</sp-menu-item>
<sp-menu-item>Select inverse</sp-menu-item>
<sp-menu-item>Feather...</sp-menu-item>
<sp-menu-item>Select and mask...</sp-menu-item>
<sp-menu-divider></sp-menu-divider>
<sp-menu-item>Save selection</sp-menu-item>
<sp-menu-item disabled>Make work path</sp-menu-item>
</sp-picker>
So, to some degree, it seems the label attribute works less well than the placeholder attribute. At least the placeholder attribute shows the initial HTML value.
Still seems like there’s a bug here, but maybe I’m doing something wrong.
I actually use picker like this and do have a placeholder in my plugin, but never tried to change it with JS. I use React, so it does all the magic in changing stuff depending on a state
@Erin_Finnegan - What’s the fix? Is the label attribute going to work or is the placeholder attribute going to work? Or both, for changing this attribute programmatically with JS?