Commit f9731ff2 authored by Weilun Shi's avatar Weilun Shi Committed by Commit Bot

[NTP] Remove focus ring when done button is disabled

Remove focus ring on custom background dialog's done button when it is
disabled.

Bug: 878709
Change-Id: I9f30a27361682a6bb91273ae43cf97e1b1030594
Reviewed-on: https://chromium-review.googlesource.com/1196165
Commit-Queue: Weilun Shi <sweilun@chromium.org>
Reviewed-by: default avatarKristi Park <kristipark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588258}
parent 42ac670f
...@@ -418,20 +418,21 @@ html[dir=rtl] #bg-sel-footer-cancel { ...@@ -418,20 +418,21 @@ html[dir=rtl] #bg-sel-footer-cancel {
0 3px 6px 2px rgba(60, 64, 67, 0.15); 0 3px 6px 2px rgba(60, 64, 67, 0.15);
} }
#bg-sel-footer-done.done-available:active { #bg-sel-footer-done:not(:disabled) {
box-shadow: 0 1px 2px 0 rgba(66, 133, 244, 0.3), background-color: rgb(26, 115, 232);
0 3px 6px 2px rgba(66, 133, 244, 0.15); color: white;
outline: initial;
} }
#bg-sel-footer-done.done-available:hover { #bg-sel-footer-done:hover:not(:disabled) {
background-color: rgb(41, 123, 231); background-color: rgb(41, 123, 231);
box-shadow: 0 1px 2px 0 rgba(66, 133, 244, 0.3), box-shadow: 0 1px 2px 0 rgba(66, 133, 244, 0.3),
0 1px 3px 1px rgba(66, 133, 244, 0.15); 0 1px 3px 1px rgba(66, 133, 244, 0.15);
} }
#bg-sel-footer-done.done-available { #bg-sel-footer-done:active:not(:disabled) {
background-color: rgb(26, 115, 232); box-shadow: 0 1px 2px 0 rgba(66, 133, 244, 0.3),
color: white; 0 3px 6px 2px rgba(66, 133, 244, 0.15);
} }
#bg-sel-footer-toggle-text { #bg-sel-footer-toggle-text {
......
...@@ -278,8 +278,7 @@ customBackgrounds.clearAttribution = function() { ...@@ -278,8 +278,7 @@ customBackgrounds.clearAttribution = function() {
}; };
customBackgrounds.unselectTile = function() { customBackgrounds.unselectTile = function() {
$(customBackgrounds.IDS.DONE) $(customBackgrounds.IDS.DONE).disabled = true;
.classList.remove(customBackgrounds.CLASSES.DONE_AVAILABLE);
customBackgrounds.selectedTile = null; customBackgrounds.selectedTile = null;
$(customBackgrounds.IDS.DONE).tabIndex = -1; $(customBackgrounds.IDS.DONE).tabIndex = -1;
}; };
...@@ -683,8 +682,7 @@ customBackgrounds.showImageSelectionDialog = function(dialogTitle) { ...@@ -683,8 +682,7 @@ customBackgrounds.showImageSelectionDialog = function(dialogTitle) {
// Turn toggle off when an image is selected. // Turn toggle off when an image is selected.
$(customBackgrounds.IDS.REFRESH_TOGGLE).children[0].checked = false; $(customBackgrounds.IDS.REFRESH_TOGGLE).children[0].checked = false;
$(customBackgrounds.IDS.DONE) $(customBackgrounds.IDS.DONE).disabled = false;
.classList.add(customBackgrounds.CLASSES.DONE_AVAILABLE);
ntpApiHandle.logEvent(BACKGROUND_CUSTOMIZATION_LOG_TYPE ntpApiHandle.logEvent(BACKGROUND_CUSTOMIZATION_LOG_TYPE
.NTP_CUSTOMIZE_CHROME_BACKGROUND_SELECT_IMAGE); .NTP_CUSTOMIZE_CHROME_BACKGROUND_SELECT_IMAGE);
}; };
...@@ -1011,6 +1009,8 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) { ...@@ -1011,6 +1009,8 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) {
$(customBackgrounds.IDS.DONE) $(customBackgrounds.IDS.DONE)
.setAttribute('aria-label', configData.translatedStrings.selectionDone); .setAttribute('aria-label', configData.translatedStrings.selectionDone);
$(customBackgrounds.IDS.DONE).disabled = true;
// Interactions with the "Upload an image" option. // Interactions with the "Upload an image" option.
var uploadImageInteraction = function(event) { var uploadImageInteraction = function(event) {
window.chrome.embeddedSearch.newTabPage.selectLocalBackgroundImage(); window.chrome.embeddedSearch.newTabPage.selectLocalBackgroundImage();
...@@ -1176,8 +1176,7 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) { ...@@ -1176,8 +1176,7 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) {
// Interactions with the done button on the background picker dialog. // Interactions with the done button on the background picker dialog.
var doneInteraction = function(event) { var doneInteraction = function(event) {
if (!$(customBackgrounds.IDS.DONE) if ($(customBackgrounds.IDS.DONE).disabled) {
.classList.contains(customBackgrounds.CLASSES.DONE_AVAILABLE)) {
return; return;
} }
customBackgrounds.setBackground( customBackgrounds.setBackground(
...@@ -1199,8 +1198,7 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) { ...@@ -1199,8 +1198,7 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) {
customBackgrounds.removeSelectedState(customBackgrounds.selectedTile); customBackgrounds.removeSelectedState(customBackgrounds.selectedTile);
customBackgrounds.selectedTile = null; customBackgrounds.selectedTile = null;
} }
$(customBackgrounds.IDS.DONE) $(customBackgrounds.IDS.DONE).disabled = false;
.classList.add(customBackgrounds.CLASSES.DONE_AVAILABLE);
}; };
// On any arrow key event in the tiles area, focus the first tile. // On any arrow key event in the tiles area, focus the first tile.
......
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