mercredi 30 mai 2018

Selected Attribute on Select Option Not Working (Ember.js + Handlebars)

I am implementing a dropdown using Ember, but I cannot set the selected property of an option element using a handlebars expression.

Here is an ember-twiddle example that shows the issue. Notice how in the DOM of the twiddle, the selected attribute does not appear for the top example.

<select
    aria-disabled=""
    aria-multiselectable=""
    disabled=
    onchange=
>
    <option selected disabled value=""></option>

    
        <option 
            value=
            selected=
            disabled=
        >
            
        </option>
    
</select>

"is-item-selected" is a custom helper that returns true if "item.state === 2", which is does when the item is selected in the dropdown.

No matter what I try in the handlebars, the selected attribute will not display (e.g. selected= does not work either). However, changing selected to data-selected works exactly as intended.

Is anyone aware of this issue? Or am I misunderstanding how the selected attribute is supposed to work?




Aucun commentaire:

Enregistrer un commentaire