Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 981c61f

Browse files
author
Erica Wright
committed
Bug 1688942 - Fix newtabExperience focus highlights. r=prathiksha,JulianWels, a=pascalc
Differential Revision: https://phabricator.services.mozilla.com/D103533
1 parent 66d891c commit 981c61f

File tree

11 files changed

+247
-80
lines changed

11 files changed

+247
-80
lines changed

browser/components/newtab/content-src/components/Base/_Base.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ main {
157157
.personalize-button {
158158
font-size: 12px;
159159
font-weight: 600;
160-
border: 1px solid transparent;
160+
border: 0;
161161
border-radius: 4px;
162162
background-color: var(--newtab-background-button-color);
163163
color: var(--newtab-background-button-text-color);
@@ -174,8 +174,6 @@ main {
174174
}
175175

176176
&:focus-visible {
177-
border-color: var(--newtab-focus-border);
178-
outline: 0;
179-
box-shadow: 0 0 0 2px var(--newtab-focus-outline);
177+
@include ds-focus-nte;
180178
}
181179
}

browser/components/newtab/content-src/components/Card/_Card.scss

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1+
// Special styling for the New Tab Experience styles,
2+
// This is to be incorporated once the styles are made permanent
13
.outer-wrapper.newtab-experience {
24
.card-outer {
35
border-radius: $border-radius-new;
46

7+
&:is(:focus):not(.placeholder) {
8+
@include ds-focus-nte;
9+
10+
transition: none;
11+
}
12+
13+
&:hover {
14+
box-shadow: none;
15+
transition: none;
16+
}
17+
518
.card {
619
box-shadow: 0 3px 8px var(--newtab-card-first-shadow), 0 0 2px var(--newtab-card-second-shadow);
720
border-radius: $border-radius-new;
@@ -10,6 +23,23 @@
1023
.card-preview-image-outer {
1124
border-radius: $border-radius-new $border-radius-new 0 0;
1225
}
26+
27+
// Temporary fix to have the context button focus blend in with other New Tab Experience context menu focus
28+
.context-menu-button {
29+
&:is(:active, :focus) {
30+
outline: 0;
31+
fill: var(--newtab-primary-action-background);
32+
border: 1px solid var(--newtab-primary-action-background);
33+
}
34+
}
35+
36+
> a {
37+
&:is(:focus) {
38+
.card {
39+
@include ds-focus-nte;
40+
}
41+
}
42+
}
1343
}
1444
}
1545

browser/components/newtab/content-src/components/DiscoveryStreamComponents/CardGrid/_CardGrid.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
$col4-header-line-height: 20;
22
$col4-header-font-size: 14;
33

4+
// Special styling for the New Tab Experience styles,
5+
// This is to be incorporated once the styles are made permanent
46
.outer-wrapper.newtab-experience {
57
.ds-card-grid {
68
&.ds-card-grid-border {
@@ -15,9 +17,8 @@ $col4-header-font-size: 14;
1517
}
1618

1719
.ds-card-link:focus {
18-
outline: none;
19-
box-shadow: 0 0 0 2px var(--newtab-focus-outline);
20-
border: 1px solid var(--newtab-focus-border);
20+
@include ds-focus-nte;
21+
transition: none;
2122
border-radius: $border-radius-new;
2223
}
2324
}

browser/components/newtab/content-src/components/DiscoveryStreamComponents/DSCard/_DSCard.scss

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,34 @@ $excerpt-line-height: 20;
280280
margin: 0;
281281
}
282282
}
283+
284+
// Special styling for the New Tab Experience styles,
285+
// This is to be incorporated once the styles are made permanent
286+
.outer-wrapper.newtab-experience {
287+
.ds-card {
288+
// Temporary fix to have the context button focus blend in with other New Tab Experience context menu focus
289+
.context-menu-button {
290+
&:is(:active, :focus) {
291+
outline: 0;
292+
fill: var(--newtab-primary-action-background);
293+
border: 1px solid var(--newtab-primary-action-background);
294+
}
295+
}
296+
297+
.ds-card-link {
298+
&:focus {
299+
@include ds-focus-nte;
300+
301+
transition: none;
302+
303+
header {
304+
@include dark-theme-only {
305+
color: $blue-40;
306+
}
307+
308+
color: $blue-60;
309+
}
310+
}
311+
}
312+
}
313+
}

browser/components/newtab/content-src/components/DiscoveryStreamComponents/TopSites/_TopSites.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,8 @@
3636
// This is the override layer.
3737
.top-sites {
3838
.top-site-outer {
39-
.top-site-inner > a:is(.active, :focus) .top-site-inner {
40-
@include ds-fade-in;
41-
42-
@include dark-theme-only {
43-
@include ds-fade-in($blue-40-40);
44-
}
39+
.top-site-inner > a:is(.active, :focus) .tile {
40+
@include ds-focus-nte;
4541
}
4642

4743
.top-site-inner > a:is(:hover) .top-site-inner {

browser/components/newtab/content-src/components/TopSites/_TopSites.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ $letter-fallback-color: $white;
119119
font-weight: 200;
120120
justify-content: center;
121121
text-transform: uppercase; // sass-lint:disable-line no-disallowed-properties
122-
transition: box-shadow $hover-transition-duration;
123122

124123
.icon-wrapper {
125124
border-radius: 4px;
@@ -569,6 +568,7 @@ $letter-fallback-color: $white;
569568
.tile {
570569
height: $top-sites-size;
571570
width: $top-sites-size;
571+
transition: box-shadow $hover-transition-duration;
572572
}
573573

574574
.top-site-icon {
@@ -687,7 +687,6 @@ $letter-fallback-color: $white;
687687
box-shadow: $inner-box-shadow-nte, $tile-shadow-second;
688688
background-color: var(--newtab-topsites-background-color);
689689
justify-content: center;
690-
transition: box-shadow $hover-transition-duration;
691690
margin: 0 auto;
692691
height: $top-sites-size-nte;
693692
width: $top-sites-size-nte;
@@ -706,8 +705,7 @@ $letter-fallback-color: $white;
706705
.sponsored-label {
707706
font-size: 12px;
708707
}
709-
}
710-
708+
}
711709

712710
.default-icon,
713711
.search-topsite {

browser/components/newtab/content-src/styles/_theme.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ body {
8787
--newtab-topsites-icon-shadow: inset #{$inner-box-shadow};
8888
--newtab-topsites-label-color: inherit;
8989
--newtab-topsites-outer-card-hover: #{$newtab-card-hover-color};
90+
--newtab-topsites-context-menu-hover: #{$newtab-card-hover-color};
9091

9192
// Cards
9293
--newtab-card-active-outline-color: #{$grey-30};
@@ -188,6 +189,7 @@ body {
188189
--newtab-topsites-icon-shadow: none;
189190
--newtab-topsites-label-color: #{$grey-10-80};
190191
--newtab-topsites-outer-card-hover: #{$newtab-card-darktheme-hover-color};
192+
--newtab-topsites-context-menu-hover: #{$newtab-card-darktheme-hover-color};
191193

192194
// Cards
193195
--newtab-card-active-outline-color: #{$grey-60};

browser/components/newtab/content-src/styles/_variables.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,21 +225,33 @@ $customize-menu-border-tint: 1px solid $newtab-card-tint;
225225
transition: box-shadow 150ms;
226226
}
227227

228+
@mixin ds-focus-nte {
229+
border: 0;
230+
outline: 0;
231+
box-shadow: 0 0 0 3px var(--newtab-focus-outline), 0 0 0 1px var(--newtab-focus-border);
232+
}
233+
228234
@mixin context-menu-button-newtab-experience {
229235
.context-menu-button {
230236
background-image: url('chrome://global/skin/icons/more.svg');
231237
border: 0;
238+
border-radius: 4px;
232239
cursor: pointer;
233240
fill: var(--newtab-icon-primary-color);
241+
-moz-context-properties: fill;
234242
height: 20px;
243+
width: 20px;
235244
inset-inline-end: -9px;
236245
opacity: 0;
237246
position: absolute;
238247
top: -20px;
239248
transition: opacity 200ms;
240249

241250
&:is(:active, :focus) {
251+
outline: 0;
242252
opacity: 1;
253+
background-color: var(--newtab-topsites-context-menu-hover);
254+
fill: var(--newtab-primary-action-background);
243255
}
244256
}
245257
}

browser/components/newtab/css/activity-stream-linux.css

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ body {
7676
--newtab-topsites-icon-shadow: inset 0 0 0 1px var(--newtab-inner-box-shadow-color);
7777
--newtab-topsites-label-color: inherit;
7878
--newtab-topsites-outer-card-hover: rgba(0, 0, 0, 0.05);
79+
--newtab-topsites-context-menu-hover: rgba(0, 0, 0, 0.05);
7980
--newtab-card-active-outline-color: #D7D7DB;
8081
--newtab-card-background-color: #FFF;
8182
--newtab-card-hairline-color: rgba(0, 0, 0, 0.1);
@@ -156,6 +157,7 @@ body {
156157
--newtab-topsites-icon-shadow: none;
157158
--newtab-topsites-label-color: rgba(249, 249, 250, 0.8);
158159
--newtab-topsites-outer-card-hover: rgba(180, 180, 180, 0.1);
160+
--newtab-topsites-context-menu-hover: rgba(180, 180, 180, 0.1);
159161
--newtab-card-active-outline-color: #4A4A4F;
160162
--newtab-card-background-color: #38383D;
161163
--newtab-card-hairline-color: rgba(249, 249, 250, 0.1);
@@ -521,7 +523,7 @@ main {
521523
.personalize-button {
522524
font-size: 12px;
523525
font-weight: 600;
524-
border: 1px solid transparent;
526+
border: 0;
525527
border-radius: 4px;
526528
background-color: var(--newtab-background-button-color);
527529
color: var(--newtab-background-button-text-color);
@@ -533,9 +535,9 @@ main {
533535
.personalize-button:active {
534536
background-color: var(--newtab-background-button-active-color); }
535537
.personalize-button:focus-visible {
536-
border-color: var(--newtab-focus-border);
538+
border: 0;
537539
outline: 0;
538-
box-shadow: 0 0 0 2px var(--newtab-focus-outline); }
540+
box-shadow: 0 0 0 3px var(--newtab-focus-outline), 0 0 0 1px var(--newtab-focus-border); }
539541

540542
.as-error-fallback {
541543
align-items: center;
@@ -637,8 +639,7 @@ main {
637639
font-size: 32px;
638640
font-weight: 200;
639641
justify-content: center;
640-
text-transform: uppercase;
641-
transition: box-shadow 150ms; }
642+
text-transform: uppercase; }
642643
.top-site-outer .tile .icon-wrapper {
643644
border-radius: 4px;
644645
width: 48px;
@@ -963,7 +964,8 @@ main {
963964

964965
.outer-wrapper:not(.newtab-experience) .top-site-outer .tile {
965966
height: 96px;
966-
width: 96px; }
967+
width: 96px;
968+
transition: box-shadow 150ms; }
967969

968970
.outer-wrapper:not(.newtab-experience) .top-site-outer .top-site-icon {
969971
box-shadow: var(--newtab-topsites-icon-shadow); }
@@ -1038,24 +1040,29 @@ main {
10381040
.outer-wrapper.newtab-experience .top-site-outer .context-menu-button {
10391041
background-image: url("chrome://global/skin/icons/more.svg");
10401042
border: 0;
1043+
border-radius: 4px;
10411044
cursor: pointer;
10421045
fill: var(--newtab-icon-primary-color);
1046+
-moz-context-properties: fill;
10431047
height: 20px;
1048+
width: 20px;
10441049
inset-inline-end: -9px;
10451050
opacity: 0;
10461051
position: absolute;
10471052
top: -20px;
10481053
transition: opacity 200ms; }
10491054
.outer-wrapper.newtab-experience .top-site-outer .context-menu-button:is(:active, :focus) {
1050-
opacity: 1; }
1055+
outline: 0;
1056+
opacity: 1;
1057+
background-color: var(--newtab-topsites-context-menu-hover);
1058+
fill: var(--newtab-primary-action-background); }
10511059
.outer-wrapper.newtab-experience .top-site-outer .edit-button {
10521060
background-image: url("chrome://activity-stream/content/data/content/assets/glyph-edit-16.svg"); }
10531061
.outer-wrapper.newtab-experience .top-site-outer .tile {
10541062
border-radius: 8px;
10551063
box-shadow: 0 3px 8px var(--newtab-inner-box-shadow-color-nte), 0 0 2px var(--newtab-tile-shadow-secondary);
10561064
background-color: var(--newtab-topsites-background-color);
10571065
justify-content: center;
1058-
transition: box-shadow 150ms;
10591066
margin: 0 auto;
10601067
height: 80px;
10611068
width: 80px; }
@@ -1874,11 +1881,27 @@ main {
18741881

18751882
.outer-wrapper.newtab-experience .card-outer {
18761883
border-radius: 8px; }
1884+
.outer-wrapper.newtab-experience .card-outer:is(:focus):not(.placeholder) {
1885+
border: 0;
1886+
outline: 0;
1887+
box-shadow: 0 0 0 3px var(--newtab-focus-outline), 0 0 0 1px var(--newtab-focus-border);
1888+
transition: none; }
1889+
.outer-wrapper.newtab-experience .card-outer:hover {
1890+
box-shadow: none;
1891+
transition: none; }
18771892
.outer-wrapper.newtab-experience .card-outer .card {
18781893
box-shadow: 0 3px 8px var(--newtab-card-first-shadow), 0 0 2px var(--newtab-card-second-shadow);
18791894
border-radius: 8px; }
18801895
.outer-wrapper.newtab-experience .card-outer .card-preview-image-outer {
18811896
border-radius: 8px 8px 0 0; }
1897+
.outer-wrapper.newtab-experience .card-outer .context-menu-button:is(:active, :focus) {
1898+
outline: 0;
1899+
fill: var(--newtab-primary-action-background);
1900+
border: 1px solid var(--newtab-primary-action-background); }
1901+
.outer-wrapper.newtab-experience .card-outer > a:is(:focus) .card {
1902+
border: 0;
1903+
outline: 0;
1904+
box-shadow: 0 0 0 3px var(--newtab-focus-outline), 0 0 0 1px var(--newtab-focus-border); }
18821905

18831906
.outer-wrapper:not(.newtab-experience) .card-outer:is(:hover, :focus, .active):not(.placeholder) {
18841907
box-shadow: 0 0 0 5px var(--newtab-card-active-outline-color);
@@ -2509,9 +2532,10 @@ main {
25092532
border-radius: 8px 8px 0 0; }
25102533

25112534
.outer-wrapper.newtab-experience .ds-card-grid .ds-card-link:focus {
2512-
outline: none;
2513-
box-shadow: 0 0 0 2px var(--newtab-focus-outline);
2514-
border: 1px solid var(--newtab-focus-border);
2535+
border: 0;
2536+
outline: 0;
2537+
box-shadow: 0 0 0 3px var(--newtab-focus-outline), 0 0 0 1px var(--newtab-focus-border);
2538+
transition: none;
25152539
border-radius: 8px; }
25162540

25172541
.ds-card-grid {
@@ -3179,16 +3203,10 @@ main {
31793203
.outer-wrapper:not(.newtab-experience) .ds-top-sites .top-sites .top-sites-list {
31803204
margin: 0 -12px; }
31813205

3182-
.outer-wrapper.newtab-experience .ds-top-sites .top-sites .top-site-outer .top-site-inner > a:is(.active, :focus) .top-site-inner {
3183-
box-shadow: 0 0 0 5px rgba(10, 132, 255, 0.3);
3184-
transition: box-shadow 150ms;
3185-
border-radius: 4px;
3186-
outline: none; }
3187-
[lwt-newtab-brighttext] .outer-wrapper.newtab-experience .ds-top-sites .top-sites .top-site-outer .top-site-inner > a:is(.active, :focus) .top-site-inner {
3188-
box-shadow: 0 0 0 5px rgba(69, 161, 255, 0.4);
3189-
transition: box-shadow 150ms;
3190-
border-radius: 4px;
3191-
outline: none; }
3206+
.outer-wrapper.newtab-experience .ds-top-sites .top-sites .top-site-outer .top-site-inner > a:is(.active, :focus) .tile {
3207+
border: 0;
3208+
outline: 0;
3209+
box-shadow: 0 0 0 3px var(--newtab-focus-outline), 0 0 0 1px var(--newtab-focus-border); }
31923210

31933211
.outer-wrapper.newtab-experience .ds-top-sites .top-sites .top-site-outer .top-site-inner > a:is(:hover) .top-site-inner {
31943212
box-shadow: 0 0 0 5px #D7D7DB;
@@ -3526,6 +3544,21 @@ main {
35263544
[lwt-newtab-brighttext] .ds-card p {
35273545
color: #F9F9FA; }
35283546

3547+
.outer-wrapper.newtab-experience .ds-card .context-menu-button:is(:active, :focus) {
3548+
outline: 0;
3549+
fill: var(--newtab-primary-action-background);
3550+
border: 1px solid var(--newtab-primary-action-background); }
3551+
3552+
.outer-wrapper.newtab-experience .ds-card .ds-card-link:focus {
3553+
border: 0;
3554+
outline: 0;
3555+
box-shadow: 0 0 0 3px var(--newtab-focus-outline), 0 0 0 1px var(--newtab-focus-border);
3556+
transition: none; }
3557+
.outer-wrapper.newtab-experience .ds-card .ds-card-link:focus header {
3558+
color: #0060DF; }
3559+
[lwt-newtab-brighttext] .outer-wrapper.newtab-experience .ds-card .ds-card-link:focus header {
3560+
color: #45A1FF; }
3561+
35293562
.story-footer {
35303563
color: var(--newtab-text-secondary-color);
35313564
inset-inline-start: 0;

0 commit comments

Comments
 (0)