Commit 69ad872e authored by tmartino's avatar tmartino Committed by Commit Bot

This CL corrects issues with screen reader accessibility on the

order summary screen. Specifically:

- Does not read the "preview" text (e.g., "123 Fake St. and 1 other...")
  as it is confusingly similar to the selected state.

- Adds accessible content when a payment method has been selected.

BUG=733684

Review-Url: https://codereview.chromium.org/2956473002
Cr-Commit-Position: refs/heads/master@{#481907}
parent 159a49c2
......@@ -327,11 +327,8 @@ class PaymentSheetRowBuilder {
base::MakeUnique<PreviewEliderLabel>(preview_text, format_string, n,
STYLE_HINT);
content_view->SetHorizontalAlignment(gfx::ALIGN_LEFT);
base::string16 accessible_content =
content_view->CreateElidedString(std::numeric_limits<int>::max());
return AccessibleContent(accessible_content)
.CreateWithButton(std::move(content_view), button_string,
button_enabled);
return CreateWithButton(std::move(content_view), button_string,
button_enabled);
}
private:
......@@ -672,10 +669,9 @@ std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() {
GetShippingAddressLabelFormAutofillProfile(
*state()->shipping_profiles()[0],
state()->GetApplicationLocale());
return builder.AccessibleContent(truncated_content)
.CreateWithButton(truncated_content,
l10n_util::GetStringUTF16(IDS_CHOOSE),
/*button_enabled=*/true);
return builder.CreateWithButton(truncated_content,
l10n_util::GetStringUTF16(IDS_CHOOSE),
/*button_enabled=*/true);
} else {
base::string16 format = l10n_util::GetPluralStringFUTF16(
IDS_PAYMENT_REQUEST_SHIPPING_ADDRESSES_PREVIEW,
......@@ -734,7 +730,8 @@ PaymentSheetViewController::CreatePaymentMethodRow() {
selected_instrument->GetLabel());
card_icon_view->SetImageSize(gfx::Size(32, 20));
return builder.Id(DialogViewID::PAYMENT_SHEET_PAYMENT_METHOD_SECTION)
return builder.AccessibleContent(selected_instrument->GetLabel())
.Id(DialogViewID::PAYMENT_SHEET_PAYMENT_METHOD_SECTION)
.CreateWithChevron(std::move(content_view), std::move(card_icon_view));
} else {
builder.Id(DialogViewID::PAYMENT_SHEET_PAYMENT_METHOD_SECTION_BUTTON);
......@@ -809,10 +806,9 @@ PaymentSheetViewController::CreateContactInfoRow() {
{autofill::NAME_FULL, autofill::PHONE_HOME_WHOLE_NUMBER,
autofill::EMAIL_ADDRESS},
3, state()->GetApplicationLocale());
return builder.AccessibleContent(truncated_content)
.CreateWithButton(truncated_content,
l10n_util::GetStringUTF16(IDS_CHOOSE),
/*button_enabled=*/true);
return builder.CreateWithButton(truncated_content,
l10n_util::GetStringUTF16(IDS_CHOOSE),
/*button_enabled=*/true);
} else {
base::string16 preview =
state()->contact_profiles()[0]->ConstructInferredLabel(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment