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,10 +327,7 @@ class PaymentSheetRowBuilder { ...@@ -327,10 +327,7 @@ class PaymentSheetRowBuilder {
base::MakeUnique<PreviewEliderLabel>(preview_text, format_string, n, base::MakeUnique<PreviewEliderLabel>(preview_text, format_string, n,
STYLE_HINT); STYLE_HINT);
content_view->SetHorizontalAlignment(gfx::ALIGN_LEFT); content_view->SetHorizontalAlignment(gfx::ALIGN_LEFT);
base::string16 accessible_content = return CreateWithButton(std::move(content_view), button_string,
content_view->CreateElidedString(std::numeric_limits<int>::max());
return AccessibleContent(accessible_content)
.CreateWithButton(std::move(content_view), button_string,
button_enabled); button_enabled);
} }
...@@ -672,8 +669,7 @@ std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() { ...@@ -672,8 +669,7 @@ std::unique_ptr<views::Button> PaymentSheetViewController::CreateShippingRow() {
GetShippingAddressLabelFormAutofillProfile( GetShippingAddressLabelFormAutofillProfile(
*state()->shipping_profiles()[0], *state()->shipping_profiles()[0],
state()->GetApplicationLocale()); state()->GetApplicationLocale());
return builder.AccessibleContent(truncated_content) return builder.CreateWithButton(truncated_content,
.CreateWithButton(truncated_content,
l10n_util::GetStringUTF16(IDS_CHOOSE), l10n_util::GetStringUTF16(IDS_CHOOSE),
/*button_enabled=*/true); /*button_enabled=*/true);
} else { } else {
...@@ -734,7 +730,8 @@ PaymentSheetViewController::CreatePaymentMethodRow() { ...@@ -734,7 +730,8 @@ PaymentSheetViewController::CreatePaymentMethodRow() {
selected_instrument->GetLabel()); selected_instrument->GetLabel());
card_icon_view->SetImageSize(gfx::Size(32, 20)); 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)); .CreateWithChevron(std::move(content_view), std::move(card_icon_view));
} else { } else {
builder.Id(DialogViewID::PAYMENT_SHEET_PAYMENT_METHOD_SECTION_BUTTON); builder.Id(DialogViewID::PAYMENT_SHEET_PAYMENT_METHOD_SECTION_BUTTON);
...@@ -809,8 +806,7 @@ PaymentSheetViewController::CreateContactInfoRow() { ...@@ -809,8 +806,7 @@ PaymentSheetViewController::CreateContactInfoRow() {
{autofill::NAME_FULL, autofill::PHONE_HOME_WHOLE_NUMBER, {autofill::NAME_FULL, autofill::PHONE_HOME_WHOLE_NUMBER,
autofill::EMAIL_ADDRESS}, autofill::EMAIL_ADDRESS},
3, state()->GetApplicationLocale()); 3, state()->GetApplicationLocale());
return builder.AccessibleContent(truncated_content) return builder.CreateWithButton(truncated_content,
.CreateWithButton(truncated_content,
l10n_util::GetStringUTF16(IDS_CHOOSE), l10n_util::GetStringUTF16(IDS_CHOOSE),
/*button_enabled=*/true); /*button_enabled=*/true);
} else { } else {
......
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