Skip to content

Commit ffcf3b8

Browse files
Merge pull request #18852 from mozilla/FXA-5787
fix(settings): make elements use proper focus colors
2 parents 8457529 + 97f88a0 commit ffcf3b8

18 files changed

Lines changed: 64 additions & 50 deletions

File tree

packages/fxa-react/components/Footer/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const Footer = () => {
1717
<LinkExternal
1818
href="https://www.mozilla.org/about/?utm_source=firefox-accounts&utm_medium=Referral"
1919
data-testid="link-mozilla"
20+
className="focus-visible-default rounded-sm outline-offset-2"
2021
>
2122
<img
2223
src={mozLogo}
@@ -33,7 +34,7 @@ export const Footer = () => {
3334
<LinkExternal
3435
data-testid="link-privacy"
3536
href="https://www.mozilla.org/privacy/websites/"
36-
className="transition-standard text-xs hover:text-grey-500 hover:underline mobileLandscape:self-end"
37+
className="transition-standard text-xs mobileLandscape:self-end hover:text-grey-500 hover:underline focus-visible-default rounded-sm"
3738
>
3839
Website Privacy Notice
3940
</LinkExternal>
@@ -44,7 +45,7 @@ export const Footer = () => {
4445
<LinkExternal
4546
data-testid="link-terms"
4647
href="https://www.mozilla.org/about/legal/terms/services/"
47-
className="transition-standard text-xs mobileLandscape:self-end hover:text-grey-500 hover:underline"
48+
className="transition-standard text-xs mobileLandscape:self-end hover:text-grey-500 hover:underline focus-visible-default rounded-sm"
4849
>
4950
Terms of Service
5051
</LinkExternal>

packages/fxa-react/components/LogoLockup/index.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@ export const LogoLockup = ({ children, className = '' }: LogoLockupProps) => {
1515
return (
1616
<>
1717
<Localized id="app-logo-alt-3">
18-
<img
19-
src={logo}
20-
data-testid="logo"
21-
className="ltr:mr-4 rtl:ml-4"
22-
alt="Mozilla m logo"
23-
/>
18+
<img src={logo} data-testid="logo" alt="Mozilla m logo" />
2419
</Localized>
2520
<h1
2621
data-testid="logo-text"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
/* This class is a baseline styling for the "focus" interactive state shared
6+
* across components, with shape-specific styles (e.g., border-radius,
7+
* outline-offset, etc) applied elsewhere.
8+
* Design document for reference: https://www.figma.com/design/2ruSnPauajQGprFy6K333u
9+
* NOTE: Using focus-visible instead of focus here because focus-visible is only
10+
* triggered when navigating with keyboard, while focus is also triggered by
11+
* mouse press, which is not the desired behavior for button-like components. */
12+
.focus-visible-default:focus-visible {
13+
@apply outline outline-blue-500 outline-2;
14+
}

packages/fxa-react/styles/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
@import './flows.css';
1414
@import './tooltips.css';
1515
@import './inputs.css';
16+
@import './focus.css';

packages/fxa-settings/src/components/Banner/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const Banner = ({
104104
<button
105105
aria-label={`Close banner`}
106106
className={classNames(
107-
'shrink-0 self-start hover:backdrop-saturate-150 focus:backdrop-saturate-200',
107+
'shrink-0 self-start hover:backdrop-saturate-150 focus:backdrop-saturate-200 focus-visible-default rounded',
108108
type === 'error' && 'hover:bg-red-200 focus:bg-red-300',
109109
type === 'info' &&
110110
!isFancy &&

packages/fxa-settings/src/components/BrandMessaging/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export const BrandMessaging = ({
154154
attrs={{ ariaLabel: true }}
155155
>
156156
<button
157-
className="w-4 h-4"
157+
className="w-4 h-4 rounded-sm focus-visible-default outline-offset-2"
158158
data-testid="close-brand-messaging"
159159
type="button"
160160
aria-label="Close banner"

packages/fxa-settings/src/components/ButtonBack/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ButtonBack = ({
3434
data-testid={dataTestId}
3535
title={localizedButtonTitle}
3636
aria-label={localizedButtonAriaLabel}
37-
className="me-4 tablet:me-0 tablet:p-4 tablet:absolute tablet:-start-24"
37+
className="me-4 tablet:me-0 tablet:p-4 tablet:absolute tablet:-start-24 rounded focus-visible-default"
3838
>
3939
<BackArrow className="w-6 h-auto text-grey-400 rtl:transform rtl:-scale-x-100" />
4040
</button>

packages/fxa-settings/src/components/InputPassword/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const InputPassword = ({
9393
<button
9494
type="button"
9595
data-testid={formatDataTestId('visibility-toggle')}
96-
className="absolute end-0 inset-y-0 my-auto mx-2 px-2 text-grey-500 box-content"
96+
className="absolute end-0 inset-y-0 my-auto mx-2 px-2 text-grey-500 box-content focus-visible-default rounded"
9797
onClick={changeVisibilityStatus}
9898
title={
9999
visible

packages/fxa-settings/src/components/ResetPasswordWarning/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ const ResetPasswordWarning = ({
3737
setExpanded((e.currentTarget as HTMLDetailsElement).open)
3838
}
3939
>
40-
{/* Arbitrary varaite [&::-webkit-details-marker]:hidden removes the list arrow on webkit based browsers */}
41-
<summary className="flex items-center cursor-pointer list-none [&::-webkit-details-marker]:hidden">
40+
{/* Arbitrary variant [&::-webkit-details-marker]:hidden removes the list arrow on webkit based browsers */}
41+
<summary className="flex items-center cursor-pointer list-none [&::-webkit-details-marker]:hidden rounded-sm focus-visible-default outline-offset-2">
4242
<WarnIcon
4343
role="img"
4444
className="me-4"

packages/fxa-settings/src/components/Settings/AlertBar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const AlertBar = () => {
110110
</p>
111111
<button
112112
className={classNames(
113-
'shrink-0 items-stretch justify-center py-2 px-3',
113+
'shrink-0 items-stretch justify-center py-2 px-3 focus-visible:rounded-sm focus-visible-default',
114114
{
115115
'hover:bg-red-200 focus:bg-red-300': alertType() === 'error',
116116
'hover:bg-blue-100 focus:bg-blue-200': alertType() === 'info',

0 commit comments

Comments
 (0)