Skip to content

Safari: amp-bind doesn't update <select> when option[selected] is mutated #17909

@matijagrcic

Description

@matijagrcic

What's the issue?

AMP.setState doesn't update the select element on Safari.

How do we reproduce the issue?

Given a simple amp-selector

  <amp-selector layout="container" on="select:AMP.setState({ selectedVariantState: { variantSku: event.targetOption, variantQuantity: 1 }})" [selected]="selectedVariantState.variantSku">

    <amp-img src="image.gif" width="64" height="64" option="12345-12345"></amp-img>
//more images omitted for brevity 
 </amp-selector >

<select  on="change:AMP.setState({ selectedVariantState: { variantSku: event.value, variantQuantity: 1  }})">
<option value="-1" selected="selectedVariantState.variantSku == ''">Select</option>
<optgroup label="Group Name">
    <option [selected]="selectedVariantState.variantSku == '12345-12345'" value="12345-12345">
       Some Value      
    </option>
</optgroup>
//more optgroups and options, omitted for brevity 
 </select>

What browsers are affected?

Mobile Safari

Which AMP version is affected?

All versions

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions