Commit b6d17696 authored by Maksim Ivanov's avatar Maksim Ivanov Committed by Commit Bot

Disable tabbing through Ash's PIN keypad buttons

This makes the buttons of the LoginPinView view
untabbable. It affects the quick_unlock and smart card PIN
keypad UI in the user pod in Ash, and also the Parent
Access Code dialog.

This should NOT be an accessibility regression, since these
buttons don't provide any extra functionality: i.e., the PIN
can still be directly entered into the input field via other
methods. The change was also approved by the a11y team (see
the attached bug).

This also makes it consistent with the HTML/Polymer-based
PIN keyboard, which was recently changed to not support
tabbing through the buttons (see the attached bug). The main
motivation is to avoid struggling with the a11y behavior of
these buttons (specifically, issues of keeping the focus and
of pronouncing the "bullet" word of the screen reader).

Bug: 1043194
Test: log in via a smart card, log out, start a login again, in the PIN dialog press Tab a few times, verify that the buttons of the PIN keyboard ("1", "2", etc.) don't get selected
Change-Id: I650878e2fcecb2fd5e35d9fe847664fa8e4a6d87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2074441
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744749}
parent 16469ef3
...@@ -90,7 +90,7 @@ class BasePinButton : public views::InkDropHostView { ...@@ -90,7 +90,7 @@ class BasePinButton : public views::InkDropHostView {
const base::string16& accessible_name, const base::string16& accessible_name,
const base::RepeatingClosure& on_press) const base::RepeatingClosure& on_press)
: on_press_(on_press), accessible_name_(accessible_name) { : on_press_(on_press), accessible_name_(accessible_name) {
SetFocusBehavior(FocusBehavior::ALWAYS); SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
SetPreferredSize(size); SetPreferredSize(size);
auto layout = std::make_unique<views::BoxLayout>( auto layout = std::make_unique<views::BoxLayout>(
......
...@@ -66,9 +66,10 @@ TEST_F(LoginPinViewTest, ButtonsFireEvents) { ...@@ -66,9 +66,10 @@ TEST_F(LoginPinViewTest, ButtonsFireEvents) {
// Verify pin button events are emitted with the correct value. // Verify pin button events are emitted with the correct value.
for (int i = 0; i <= 9; ++i) { for (int i = 0; i <= 9; ++i) {
test_api.GetButton(i)->RequestFocus(); test_api.GetButton(i)->GetFocusManager()->SetFocusedView(
test_api.GetButton(i));
generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE); generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE);
EXPECT_TRUE(value_.has_value()); ASSERT_TRUE(value_.has_value());
EXPECT_EQ(*value_, i); EXPECT_EQ(*value_, i);
value_.reset(); value_.reset();
} }
...@@ -76,7 +77,8 @@ TEST_F(LoginPinViewTest, ButtonsFireEvents) { ...@@ -76,7 +77,8 @@ TEST_F(LoginPinViewTest, ButtonsFireEvents) {
// Verify backspace events are emitted. // Verify backspace events are emitted.
EXPECT_EQ(0, backspace_); EXPECT_EQ(0, backspace_);
test_api.GetBackspaceButton()->SetEnabled(true); test_api.GetBackspaceButton()->SetEnabled(true);
test_api.GetBackspaceButton()->RequestFocus(); test_api.GetBackspaceButton()->GetFocusManager()->SetFocusedView(
test_api.GetBackspaceButton());
generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE); generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE);
EXPECT_EQ(1, backspace_); EXPECT_EQ(1, backspace_);
...@@ -233,7 +235,8 @@ TEST_F(LoginPinViewTest, BackButtonEnter) { ...@@ -233,7 +235,8 @@ TEST_F(LoginPinViewTest, BackButtonEnter) {
EXPECT_FALSE(test_api.GetBackButton()->GetVisible()); EXPECT_FALSE(test_api.GetBackButton()->GetVisible());
view_->SetBackButtonVisible(true); view_->SetBackButtonVisible(true);
test_api.GetBackButton()->RequestFocus(); test_api.GetBackButton()->GetFocusManager()->SetFocusedView(
test_api.GetBackButton());
EXPECT_EQ(0, back_); EXPECT_EQ(0, back_);
generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE); generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE);
EXPECT_EQ(1, back_); EXPECT_EQ(1, back_);
......
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