Bug 197240 - WebCore::PaymentShippingOption::selected value is ignored
Summary: WebCore::PaymentShippingOption::selected value is ignored
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: Safari 12
Hardware: iPhone / iPad iOS 12
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-04-24 13:14 PDT by Antoine du Hamel
Modified: 2019-04-24 20:35 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine du Hamel 2019-04-24 13:14:00 PDT
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/
Comment 1 Radar WebKit Bug Importer 2019-04-24 20:35:38 PDT
<rdar://problem/50193130>