amphtml: Safari: amp-bind doesn't update
when option[selected] is mutated 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 About this issue Original URL State: closed Created 6 years ago Comments: 17 (2 by maintainers) Most upvoted comments Thanks @choumx . Will verify this next week and we should then finally be able to push the AMP version of our product detail pages which contain multiple variants. +1 matijagrcic on Jan 18, 2019 Going to schedule this for our end-of-year fix-it. Thanks for your patience! +1 dreamofabear on Dec 4, 2018 I initially thought this was the same issue as the jQuery example but it’s actually unrelated. Browsers always sync the selected attribute and property. Right, setting selectedIndex on the ancestor <select> element is what I meant by “manually”. +1 dreamofabear on Sep 10, 2018 Thanks for the report. Probably an attribute vs. property issue. We already handle this correctly for <input> elements, just need to add <select> too. +1 dreamofabear on Sep 10, 2018 Also does not work on desktop Safari. Probably related to the problem that dynamically setting selected on <option> does not change the selected value on Safari (I saw that selected was correctly set on <option value="12345-12345"> on Safari also, but simply the displayed value of selection does not change) (seen previously for jQuery also) +1 kevinkassimo on Sep 7, 2018 Read more comments on GitHub ← amphtml: Running local server on non-localhost causes breakages amphtml: `sanitizeHtml` in src/sanitizer.js is causing visual diff JS errors (started with prod push) → Table of contents Issue description Top comments About this issue Original URL State: closed Created 6 years ago Comments: 17 (2 by maintainers)