Commit eab62498 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Chromium LUCI CQ

[Autofill] Increase dropdown touch target

Before this patch, the touch target of the dropdowns in the card and
address editors were 24dp tall, which is shorter than the 48dp required
for accessibility.

This patch adds a 13dp padding on top and bottom of the dropdowns in the
card and address editor.

Because varying sizes of string values in the dropdown can wrap and
cause the dropdown height to increase, alignment with text fields on the
same row is difficult, so dropdowns are now prevented from sharing the
same line with text fields. This affects the US address format in
particular, where the "State" dropdown shared a line with the "ZIP Code"
textfield. Other forms that shared two dropdowns in the row (e.g.,
expiration month and year in card form) or two textfields in the row are
not affected.

After this patch, the touch target of the dropdowns in the card and
address editors is at least 48dp tall.

Bug: 977272
Change-Id: I9b99f514a7427af7ddf7f0963c724f2cdda0cb0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586147Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836120}
parent 59e1fc78
......@@ -80,7 +80,6 @@ public class EditorDialog
private final Handler mHandler;
private final TextView.OnEditorActionListener mEditorActionListener;
private final int mHalfRowMargin;
private final int mDropdownTopPadding;
private final List<EditorFieldView> mFieldViews;
private final List<EditText> mEditableTextFields;
private final List<Spinner> mDropdownFields;
......@@ -139,8 +138,6 @@ public class EditorDialog
mHalfRowMargin = activity.getResources().getDimensionPixelSize(
R.dimen.editor_dialog_section_large_spacing);
mDropdownTopPadding = activity.getResources().getDimensionPixelSize(
R.dimen.payments_section_dropdown_top_padding);
mFieldViews = new ArrayList<>();
mEditableTextFields = new ArrayList<>();
mDropdownFields = new ArrayList<>();
......@@ -398,6 +395,13 @@ public class EditorDialog
if (nextFieldModel.isFullLine()) useFullLine = true;
}
// Always keep dropdowns and text fields on different lines because of height
// differences.
if (!isLastField && !useFullLine
&& fieldModel.isDropdownField() != nextFieldModel.isDropdownField()) {
useFullLine = true;
}
if (useFullLine || isLastField) {
addFieldViewToEditor(mDataView, fieldModel);
} else {
......@@ -419,15 +423,6 @@ public class EditorDialog
lastParams.width = 0;
lastParams.weight = 1;
// Align the text field and the dropdown field.
if ((fieldModel.isTextField() && nextFieldModel.isDropdownField())
|| (nextFieldModel.isTextField() && fieldModel.isDropdownField())) {
LinearLayout.LayoutParams dropdownParams =
fieldModel.isDropdownField() ? firstParams : lastParams;
dropdownParams.topMargin = mDropdownTopPadding;
dropdownParams.bottomMargin = 0;
}
i = i + 1;
}
}
......
......@@ -29,6 +29,7 @@
pref_autofill_field_horizontal_padding exists because TextInputLayouts have an internal
padding set.
-->
<dimen name="pref_autofill_dropdown_vertical_padding">13dp</dimen>
<dimen name="pref_autofill_content_spacing">12dp</dimen>
<dimen name="pref_autofill_field_horizontal_padding">4dp</dimen>
<dimen name="pref_autofill_field_top_margin">8dp</dimen>
......
......@@ -23,9 +23,11 @@
android:id="@+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/pref_autofill_field_top_margin"
android:padding="0dp"
android:dropDownWidth="match_parent" />
android:dropDownWidth="match_parent"
android:paddingBottom="@dimen/pref_autofill_dropdown_vertical_padding"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="@dimen/pref_autofill_dropdown_vertical_padding" />
<View android:id="@+id/spinner_underline" style="@style/PreferenceSpinnerUnderlineView" />
......
......@@ -14,7 +14,6 @@
<dimen name="payments_section_checking_spacing">6dp</dimen>
<dimen name="payments_section_descriptive_item_spacing">40dp</dimen>
<dimen name="payments_section_add_button_height">48dp</dimen>
<dimen name="payments_section_dropdown_top_padding">5dp</dimen>
<dimen name="payments_ui_max_dialog_width">0dp</dimen>
<dimen name="payments_ui_translation">100dp</dimen>
<dimen name="payments_favicon_size">24dp</dimen>
......
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