Commit 923bb99a authored by Gordon Seto's avatar Gordon Seto Committed by Commit Bot

[CrOS Settings] Remove close button and description from A11y dialog

Remove the close button from the disable confirmation dialog as
it duplicates functionality already in the cancel button. Remove
the confirmation description as it repeats the title.

Screenshots:

Before:
Autoclick: https://screenshot.googleplex.com/uB3ZhRSmVTGSLRg.png
Switch Access: https://screenshot.googleplex.com/7WsEbWDBb77MwDg

After:
Autoclick: https://screenshot.googleplex.com/3DNmukRFCNQ6WoG.png
Switch Access: https://screenshot.googleplex.com/3xveLtXSYo86cYL.png

Bug: 1125247
Change-Id: Iaf0f008e7e3d6f8fa17ec58eaf7575c27df90303
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2466508
Commit-Queue: Gordon Seto <gordonseto@google.com>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarAzeem Arshad <azeemarshad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816835}
parent 4363f493
...@@ -1896,8 +1896,7 @@ void AccessibilityControllerImpl::UpdateFeatureFromPref(FeatureType feature) { ...@@ -1896,8 +1896,7 @@ void AccessibilityControllerImpl::UpdateFeatureFromPref(FeatureType feature) {
} else { } else {
// Show a dialog before disabling Switch Access. // Show a dialog before disabling Switch Access.
new AccessibilityFeatureDisableDialog( new AccessibilityFeatureDisableDialog(
IDS_ASH_SWITCH_ACCESS_DISABLE_CONFIRMATION_TITLE, IDS_ASH_SWITCH_ACCESS_DISABLE_CONFIRMATION_TEXT,
IDS_ASH_SWITCH_ACCESS_DISABLE_CONFIRMATION_BODY,
base::BindOnce( base::BindOnce(
&AccessibilityControllerImpl::SwitchAccessDisableDialogClosed, &AccessibilityControllerImpl::SwitchAccessDisableDialogClosed,
weak_ptr_factory_.GetWeakPtr(), true), weak_ptr_factory_.GetWeakPtr(), true),
......
...@@ -720,10 +720,7 @@ This file contains the strings for ash. ...@@ -720,10 +720,7 @@ This file contains the strings for ash.
<message name="IDS_ASH_DICTATION_CONFIRMATION_BODY" desc="The message shown the first time the user enables Dictation, explaining that the audio data will be sent to Google for transcription"> <message name="IDS_ASH_DICTATION_CONFIRMATION_BODY" desc="The message shown the first time the user enables Dictation, explaining that the audio data will be sent to Google for transcription">
Dictation sends your voice to Google to allow voice typing in any text field. Dictation sends your voice to Google to allow voice typing in any text field.
</message> </message>
<message name="IDS_ASH_SWITCH_ACCESS_DISABLE_CONFIRMATION_TITLE" desc="The title for the modal dialog shown when the user disables Switch Access, to confirm they meant to disable the feature."> <message name="IDS_ASH_SWITCH_ACCESS_DISABLE_CONFIRMATION_TEXT" desc="The text for the modal dialog shown when the user disables Switch Access, to confirm they meant to disable the feature.">
Turn off Switch Access
</message>
<message name="IDS_ASH_SWITCH_ACCESS_DISABLE_CONFIRMATION_BODY" desc="The message in the modal dialog shown when the user disables Switch Access, to confirm they meant to disable the feature.">
Are you sure you want to turn off Switch Access? Are you sure you want to turn off Switch Access?
</message> </message>
<message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE" desc="The label used in the accessibility menu of the system tray to toggle on/off high contrast feature."> <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE" desc="The label used in the accessibility menu of the system tray to toggle on/off high contrast feature.">
...@@ -777,10 +774,7 @@ This file contains the strings for ash. ...@@ -777,10 +774,7 @@ This file contains the strings for ash.
<message name="IDS_ASH_AUTOCLICK_SCROLL_CLOSE" desc="The tooltip text for the automatic clicks menu option that results in the scrolling menu being closed."> <message name="IDS_ASH_AUTOCLICK_SCROLL_CLOSE" desc="The tooltip text for the automatic clicks menu option that results in the scrolling menu being closed.">
Close Close
</message> </message>
<message name="IDS_ASH_AUTOCLICK_DISABLE_CONFIRMATION_TITLE" desc="The title for the modal dialog shown when the user disables automatic clicks, to confirm they meant to disable the feature."> <message name="IDS_ASH_AUTOCLICK_DISABLE_CONFIRMATION_TEXT" desc="The text for the modal dialog shown when the user disables automatic clicks, to confirm they meant to disable the feature.">
Turn off automatic clicks
</message>
<message name="IDS_ASH_AUTOCLICK_DISABLE_CONFIRMATION_BODY" desc="The message in the modal dialog shown when the user disables automatic clicks, to confirm they meant to disable the feature">
Are you sure you want to turn off automatic clicks? Are you sure you want to turn off automatic clicks?
</message> </message>
<message name="IDS_ASH_SWITCH_ACCESS_BACK_BUTTON_DESCRIPTION" desc="The tooltip text for the Switch Access back button. The back button allows users to exit the feature's current focus area."> <message name="IDS_ASH_SWITCH_ACCESS_BACK_BUTTON_DESCRIPTION" desc="The tooltip text for the Switch Access back button. The back button allows users to exit the feature's current focus area.">
......
e7e4f69bf2e308582095deaf656a7206370fef83
\ No newline at end of file
b687194a5ce1426254b9382cd2746aa616858b03
\ No newline at end of file
fd56045a0818cccf385e9c7eef06944d926573d3
\ No newline at end of file
b687194a5ce1426254b9382cd2746aa616858b03
\ No newline at end of file
...@@ -137,8 +137,7 @@ void AutoclickController::SetEnabled(bool enabled, ...@@ -137,8 +137,7 @@ void AutoclickController::SetEnabled(bool enabled,
return; return;
// Show a confirmation dialog before disabling autoclick. // Show a confirmation dialog before disabling autoclick.
auto* dialog = new AccessibilityFeatureDisableDialog( auto* dialog = new AccessibilityFeatureDisableDialog(
IDS_ASH_AUTOCLICK_DISABLE_CONFIRMATION_TITLE, IDS_ASH_AUTOCLICK_DISABLE_CONFIRMATION_TEXT,
IDS_ASH_AUTOCLICK_DISABLE_CONFIRMATION_BODY,
// Callback for if the user accepts the dialog // Callback for if the user accepts the dialog
base::BindOnce([]() { base::BindOnce([]() {
// If they accept, actually disable autoclick. // If they accept, actually disable autoclick.
......
...@@ -1084,16 +1084,6 @@ TEST_F(AutoclickTest, ConfirmationDialogShownWhenDisablingFeature) { ...@@ -1084,16 +1084,6 @@ TEST_F(AutoclickTest, ConfirmationDialogShownWhenDisablingFeature) {
EXPECT_TRUE(Shell::Get()->accessibility_controller()->autoclick().enabled()); EXPECT_TRUE(Shell::Get()->accessibility_controller()->autoclick().enabled());
EXPECT_TRUE(GetAutoclickController()->IsEnabled()); EXPECT_TRUE(GetAutoclickController()->IsEnabled());
// Disable it again and close the dialog; the feature stays enabled.
Shell::Get()->accessibility_controller()->autoclick().SetEnabled(false);
dialog = GetAutoclickController()->GetDisableDialogForTesting();
ASSERT_TRUE(dialog);
dialog->GetWidget()->Close();
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(GetAutoclickController()->GetDisableDialogForTesting());
EXPECT_TRUE(Shell::Get()->accessibility_controller()->autoclick().enabled());
EXPECT_TRUE(GetAutoclickController()->IsEnabled());
// Try to disable it again, and this time accept the dialog to actually // Try to disable it again, and this time accept the dialog to actually
// disable the feature. // disable the feature.
Shell::Get()->accessibility_controller()->autoclick().SetEnabled(false); Shell::Get()->accessibility_controller()->autoclick().SetEnabled(false);
......
...@@ -23,28 +23,33 @@ namespace ash { ...@@ -23,28 +23,33 @@ namespace ash {
AccessibilityFeatureDisableDialog::AccessibilityFeatureDisableDialog( AccessibilityFeatureDisableDialog::AccessibilityFeatureDisableDialog(
int window_title_text_id, int window_title_text_id,
int dialog_text_id,
base::OnceClosure on_accept_callback, base::OnceClosure on_accept_callback,
base::OnceClosure on_cancel_callback) base::OnceClosure on_cancel_callback)
: on_cancel_callback_(std::move(on_cancel_callback)) { : on_cancel_callback_(std::move(on_cancel_callback)) {
SetModalType(ui::MODAL_TYPE_SYSTEM); SetModalType(ui::MODAL_TYPE_SYSTEM);
SetTitle(l10n_util::GetStringUTF16(window_title_text_id));
SetButtonLabel(ui::DIALOG_BUTTON_OK, SetButtonLabel(ui::DIALOG_BUTTON_OK,
l10n_util::GetStringUTF16(IDS_ASH_YES_BUTTON)); l10n_util::GetStringUTF16(IDS_ASH_YES_BUTTON));
SetAcceptCallback(std::move(on_accept_callback)); SetAcceptCallback(std::move(on_accept_callback));
SetShowCloseButton(false);
auto on_cancel = [](AccessibilityFeatureDisableDialog* dialog) { auto on_cancel = [](AccessibilityFeatureDisableDialog* dialog) {
std::move(dialog->on_cancel_callback_).Run(); std::move(dialog->on_cancel_callback_).Run();
}; };
SetCancelCallback(base::BindOnce(on_cancel, base::Unretained(this))); SetCancelCallback(base::BindOnce(on_cancel, base::Unretained(this)));
SetCloseCallback(base::BindOnce(on_cancel, base::Unretained(this)));
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
SetBorder(views::CreateEmptyBorder( SetBorder(views::CreateEmptyBorder(
views::LayoutProvider::Get()->GetDialogInsetsForContentType( views::LayoutProvider::Get()->GetDialogInsetsForContentType(
views::TEXT, views::TEXT))); views::TEXT, views::TEXT)));
AddChildView(std::make_unique<views::Label>(
l10n_util::GetStringUTF16(dialog_text_id))); auto body_label = std::make_unique<views::Label>(
l10n_util::GetStringUTF16(window_title_text_id),
views::style::CONTEXT_DIALOG_BODY_TEXT, views::style::STYLE_PRIMARY);
body_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
AddChildView(body_label.release());
set_margins(views::LayoutProvider::Get()->GetDialogInsetsForContentType(
views::TEXT, views::TEXT));
// Parent the dialog widget to the LockSystemModalContainer, or // Parent the dialog widget to the LockSystemModalContainer, or
// OverlayContainer to ensure that it will get displayed on respective // OverlayContainer to ensure that it will get displayed on respective
......
...@@ -20,7 +20,6 @@ namespace ash { ...@@ -20,7 +20,6 @@ namespace ash {
class AccessibilityFeatureDisableDialog : public views::DialogDelegateView { class AccessibilityFeatureDisableDialog : public views::DialogDelegateView {
public: public:
AccessibilityFeatureDisableDialog(int window_title_text_id, AccessibilityFeatureDisableDialog(int window_title_text_id,
int dialog_text_id,
base::OnceClosure on_accept_callback, base::OnceClosure on_accept_callback,
base::OnceClosure on_cancel_callback); base::OnceClosure on_cancel_callback);
~AccessibilityFeatureDisableDialog() override; ~AccessibilityFeatureDisableDialog() override;
......
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