Bug 197240
| Summary: | WebCore::PaymentShippingOption::selected value is ignored | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Antoine du Hamel <duhamelantoine1995> |
| Component: | WebCore JavaScript | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | aestes, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 12 | ||
| Hardware: | iPhone / iPad | ||
| OS: | iOS 12 | ||
Antoine du Hamel
According to https://www.w3.org/TR/payment-request/#paymentshippingoption-dictionary, setting the selected member to true indicates that this is the default selected PaymentShippingOption in a sequence. User agents SHOULD display this option by default in the user interface.
It seems WebKit always pick up the first `PaymentShippingOption` in the sequence, and ignores the `selected` member.
```js
const currency = 'USD';
const shippingOptions = [
{
id: "fancy-postal",
label: "Fancy postal service",
amount: { currency, value: "100" },
},
{
id: "basic-postal",
label: "Default postal service",
amount: { currency, value: "1.00" },
selected: true,
},
{
id: "free-postal",
label: "Free postal service",
amount: { currency, value: "0" },
},
];
```
In this example, `basic-postal` should be the default choice (which is the case on Chromium), but instead `fancy-postal` is selected by default.
Demo available here: https://aduh95.github.io/payment-request-test/
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/50193130>