Commit f1208e12 authored by Keren Zhu's avatar Keren Zhu Committed by Commit Bot

cbuiv: Fix focus of snoozable IPH bubble

* Allow focus on snoozable bubble.
* Adjust focused button text and background color according to
  UX spec: go/desktop-iph-snooze-ux-spec

The spec also stipulates a new set of font sizes and text alignment.
I will submit a separate CL to address them.

Bug: 1121399
Change-Id: Ifeb9caf51ba328697b930b4eba19106e83664f48
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2423307Reviewed-by: default avatarCollin Baker <collinbaker@chromium.org>
Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809839}
parent c7b06ab2
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
#include "chrome/browser/ui/views/in_product_help/feature_promo_bubble_timeout.h" #include "chrome/browser/ui/views/in_product_help/feature_promo_bubble_timeout.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/variations/variations_associated_data.h" #include "components/variations/variations_associated_data.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/theme_provider.h" #include "ui/base/theme_provider.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/insets.h"
#include "ui/gfx/text_utils.h" #include "ui/gfx/text_utils.h"
#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/accessibility/view_accessibility.h"
...@@ -47,7 +47,18 @@ constexpr base::TimeDelta kDelayShort = base::TimeDelta::FromSeconds(3); ...@@ -47,7 +47,18 @@ constexpr base::TimeDelta kDelayShort = base::TimeDelta::FromSeconds(3);
// The insets from the bubble border to the text inside. // The insets from the bubble border to the text inside.
constexpr gfx::Insets kBubbleContentsInsets(12, 16); constexpr gfx::Insets kBubbleContentsInsets(12, 16);
// The insets from the button border to the text inside.
constexpr gfx::Insets kBubbleButtonPadding(8, 10); constexpr gfx::Insets kBubbleButtonPadding(8, 10);
// The text color of the button.
constexpr SkColor kBubbleButtonTextColor = SK_ColorWHITE;
// The focus ring color of the button.
constexpr SkColor kBubbleButtonFocusRingColor = SK_ColorWHITE;
// The background color of the button when focused.
constexpr SkColor kBubbleButtonFocusedBackgroundColor =
gfx::kGoogleBlue600;
} // namespace } // namespace
namespace views { namespace views {
...@@ -65,6 +76,9 @@ class MdIPHBubbleButton : public MdTextButton { ...@@ -65,6 +76,9 @@ class MdIPHBubbleButton : public MdTextButton {
SetProminent(true); SetProminent(true);
// Button color is the same as IPH bubble's color. // Button color is the same as IPH bubble's color.
SetBgColorOverride(SK_ColorTRANSPARENT); SetBgColorOverride(SK_ColorTRANSPARENT);
// Do not grey out button text on blur.
SetTextColor(ButtonState::STATE_DISABLED, kBubbleButtonTextColor);
focus_ring()->SetColor(kBubbleButtonFocusRingColor);
} }
void UpdateBackgroundColor() override { void UpdateBackgroundColor() override {
...@@ -73,7 +87,8 @@ class MdIPHBubbleButton : public MdTextButton { ...@@ -73,7 +87,8 @@ class MdIPHBubbleButton : public MdTextButton {
// Adapted from MdTextButton::UpdateBackgroundColor() // Adapted from MdTextButton::UpdateBackgroundColor()
ui::NativeTheme* theme = GetNativeTheme(); ui::NativeTheme* theme = GetNativeTheme();
SkColor bg_color = SK_ColorTRANSPARENT; SkColor bg_color =
HasFocus() ? kBubbleButtonFocusedBackgroundColor : SK_ColorTRANSPARENT;
if (GetState() == STATE_PRESSED) if (GetState() == STATE_PRESSED)
theme->GetSystemButtonPressedColor(bg_color); theme->GetSystemButtonPressedColor(bg_color);
......
...@@ -87,8 +87,12 @@ void FeaturePromoRegistry::RegisterKnownFeatures() { ...@@ -87,8 +87,12 @@ void FeaturePromoRegistry::RegisterKnownFeatures() {
params.arrow = views::BubbleBorder::TOP_LEFT; params.arrow = views::BubbleBorder::TOP_LEFT;
// Turn on IPH Snooze only for Tab Group. // Turn on IPH Snooze only for Tab Group.
params.allow_snooze = base::FeatureList::IsEnabled( if (base::FeatureList::IsEnabled(
feature_engagement::kIPHDesktopSnoozeFeature); feature_engagement::kIPHDesktopSnoozeFeature)) {
params.allow_focus = true;
params.persist_on_blur = true;
params.allow_snooze = true;
}
RegisterFeature(feature_engagement::kIPHDesktopTabGroupsNewGroupFeature, RegisterFeature(feature_engagement::kIPHDesktopTabGroupsNewGroupFeature,
params, base::BindRepeating(GetTabGroupsAnchorView)); params, base::BindRepeating(GetTabGroupsAnchorView));
......
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