Commit 5ee603a7 authored by yilkal's avatar yilkal Committed by Commit Bot

Enable autosubmit when input field is complete for the first time.

This CL enables autosubmit of the pac when input field is complete.
It updates the tests to ensure that they don't have to press the
submit button the first time the input field is complete.

Bug: 999389
Change-Id: I287f228de484c466df71f0a9d713d9020e2aee4b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1784938Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarAga Wronska <agawronska@chromium.org>
Commit-Queue: Yilkal Abe <yilkal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693936}
parent d7a7e0be
...@@ -707,7 +707,6 @@ ParentAccessView::ParentAccessView(const AccountId& account_id, ...@@ -707,7 +707,6 @@ ParentAccessView::ParentAccessView(const AccountId& account_id,
l10n_util::GetStringUTF16(IDS_ASH_LOGIN_SUBMIT_BUTTON_ACCESSIBLE_NAME)); l10n_util::GetStringUTF16(IDS_ASH_LOGIN_SUBMIT_BUTTON_ACCESSIBLE_NAME));
submit_button_->SetFocusBehavior(FocusBehavior::ALWAYS); submit_button_->SetFocusBehavior(FocusBehavior::ALWAYS);
footer->AddChildView(submit_button_); footer->AddChildView(submit_button_);
add_spacer(kSubmitButtonBottomMarginDp); add_spacer(kSubmitButtonBottomMarginDp);
// Pin keyboard is only shown in tablet mode. // Pin keyboard is only shown in tablet mode.
...@@ -863,6 +862,12 @@ void ParentAccessView::OnInputChange(bool complete, bool last_field_active) { ...@@ -863,6 +862,12 @@ void ParentAccessView::OnInputChange(bool complete, bool last_field_active) {
submit_button_->SetEnabled(complete); submit_button_->SetEnabled(complete);
if (complete && last_field_active) { if (complete && last_field_active) {
if (auto_submit_enabled_) {
auto_submit_enabled_ = false;
SubmitCode();
return;
}
// Moving focus is delayed by using PostTask to allow for proper // Moving focus is delayed by using PostTask to allow for proper
// a11y announcements. // a11y announcements.
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
......
...@@ -184,6 +184,9 @@ class ASH_EXPORT ParentAccessView : public views::DialogDelegateView, ...@@ -184,6 +184,9 @@ class ASH_EXPORT ParentAccessView : public views::DialogDelegateView,
State state_ = State::kNormal; State state_ = State::kNormal;
// Auto submit code when the last input has been inserted.
bool auto_submit_enabled_ = true;
views::Label* title_label_ = nullptr; views::Label* title_label_ = nullptr;
views::Label* description_label_ = nullptr; views::Label* description_label_ = nullptr;
AccessCodeInput* access_code_view_ = nullptr; AccessCodeInput* access_code_view_ = nullptr;
......
This diff is collapsed.
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