[SalesForce] text property of ui:inputSelectOption with aura:iteration not working correctly

My understanding of the text-property from the ui:inputSelectOption is that I can add underlaying data (in difference to the label-property which displays the data on the GUI-Interface).
In my opinion this example should work without any issues:

<aura:component>

<aura:attribute name="dataProvider" type="Object[]" access="global" 
    default="[{name: 'Tom'}, {name: 'Bob'}, {name: 'Tim'}]" />

<ui:inputSelect>
    <aura:iteration items="{!v.dataProvider}" var="dataItem" indexVar="dataIndex">
            <ui:inputSelectOption label="{!dataItem.name}" text="{!dataIndex}" />
    </aura:iteration>
</ui:inputSelect>

But I cannot change the selection of the input select – it always jumps back to the first entry (Mac OS X, Chrome, Lightning Experience):
enter image description here

enter image description here

enter image description here

Is this a bug? When I hardcode the inputSelectOptions by not using aura:iteration everything works fine. Same when I do not assign the text-property.

Best Answer

Trying it on my end... something funky definitely happening there, having to do with binding a numeric value to that text field. Here is my stupid hack of a fix:

<aura:attribute name="dataProvider" type="Map[]" access="global" 
                default="[{name: 'Tom'}, {name: 'Bob'}, {name: 'Tim'}]" />

<ui:inputSelect>
    <aura:iteration items="{!v.dataProvider}" var="dataItem" indexVar="dataIndex">
        <ui:inputSelectOption label="{!dataItem.name}" text="{!''+dataIndex}" />
    </aura:iteration>
</ui:inputSelect>

Adding '' + the index ensures it treats it as a string and that seems to unbreak the select list.

Note also that you can bind a Map[] directly to the items property of ui:inputSelect. For example:

<aura:attribute name="items" type="Map[]" access="global" 
                default="[{label: 'Tom', value:0}, {label: 'Bob', value:1}, {label: 'Tim', value:2}]" />

<ui:inputSelect options="{!v.items}" />