Skip to content

Commit

Permalink
feat(a11y): update font colors for contrast and adjust active state i…
Browse files Browse the repository at this point in the history
…n header (#76)
  • Loading branch information
MelissaDTH authored and ChristiaanScheermeijer committed Feb 8, 2024
1 parent 769cac4 commit 0e18789
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 17 deletions.
3 changes: 3 additions & 0 deletions packages/ui-react/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Props = {
busy?: boolean;
id?: string;
as?: 'button' | 'a';
activeClassname?: string;
} & React.AriaAttributes;

const Button: React.FC<Props> = ({
Expand All @@ -47,11 +48,13 @@ const Button: React.FC<Props> = ({
as = 'button',
onClick,
className,
activeClassname = '',
...rest
}: Props) => {
const buttonClassName = (isActive: boolean) =>
classNames(styles.button, className, styles[color], styles[variant], {
[styles.active]: isActive,
[activeClassname]: isActive,
[styles.fullWidth]: fullWidth,
[styles.large]: size === 'large',
[styles.small]: size === 'small',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`<Button> > renders and matches snapshot 1`] = `
<div>
<button
class="_button_f8f296 _default_f8f296 _outlined_f8f296 _active_f8f296"
class="_button_f8f296 _default_f8f296 _outlined_f8f296 _active_f8f296 "
type="button"
>
<span>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-react/src/components/Header/Header.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
height: 36px;
min-height: 36px;
margin: 0 6px;
padding: 0 calc(#{variables.$base-spacing} / 2);
padding: calc(#{variables.$header-height} / 2.5) calc(#{variables.$base-spacing} / 2);
font-weight: var(--body-font-weight-bold);
font-size: 18px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ exports[`<SideBar /> > renders sideBar closed 1`] = `
>
<a
aria-current="page"
class="_button_f8f296 _default_f8f296 _outlined_f8f296 _active_f8f296"
class="_button_f8f296 _default_f8f296 _outlined_f8f296 _active_f8f296 "
href="/"
>
<span>
Expand Down Expand Up @@ -91,7 +91,7 @@ exports[`<SideBar /> > renders sideBar opened 1`] = `
>
<a
aria-current="page"
class="_button_f8f296 _default_f8f296 _outlined_f8f296 _active_f8f296"
class="_button_f8f296 _default_f8f296 _outlined_f8f296 _active_f8f296 "
href="/"
>
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
.sectionHeader {
width: 100%;
padding: 0 0 12px 24px;
color: variables.$slate-gray;
color: variables.$white;
font-weight: 700;
font-size: 12px;
text-transform: uppercase;
opacity: 0.7;
}

.profileButton {
Expand Down
7 changes: 7 additions & 0 deletions packages/ui-react/src/containers/Layout/Layout.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@ div.testFixMargin {
.main {
height: 100%;
}

.headerButton {
&:not(:focus) {
border-bottom: 2px variables.$white solid;
border-radius: 0;
}
}
4 changes: 2 additions & 2 deletions packages/ui-react/src/containers/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ const Layout = () => {
isSelectingProfile: selectProfile.isLoading,
}}
>
<Button label={t('home')} to="/" variant="text" />
<Button activeClassname={styles.headerButton} label={t('home')} to="/" variant="text" />
{menu.map((item) => (
<Button key={item.contentId} label={item.label} to={playlistURL(item.contentId)} variant="text" />
<Button activeClassname={styles.headerButton} key={item.contentId} label={item.label} to={playlistURL(item.contentId)} variant="text" />
))}
</Header>
<main id="content" className={styles.main} tabIndex={-1}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports[`<Layout /> > renders layout 1`] = `
>
<a
aria-current="page"
class="_button_f8f296 _default_f8f296 _text_f8f296 _active_f8f296"
class="_button_f8f296 _default_f8f296 _text_f8f296 _active_f8f296 _headerButton_c71437"
href="/"
>
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports[`User Component tests > Account Page 1`] = `
<li>
<a
aria-current="page"
class="_button_f8f296 _button_e9c5ca _default_f8f296 _text_f8f296 _active_f8f296"
class="_button_f8f296 _button_e9c5ca _default_f8f296 _text_f8f296 _active_f8f296 "
href="/u/my-account"
>
<div
Expand Down Expand Up @@ -317,7 +317,7 @@ exports[`User Component tests > Favorites Page 1`] = `
<li>
<a
aria-current="page"
class="_button_f8f296 _button_e9c5ca _default_f8f296 _text_f8f296 _active_f8f296"
class="_button_f8f296 _button_e9c5ca _default_f8f296 _text_f8f296 _active_f8f296 "
href="/u/favorites"
>
<div
Expand Down Expand Up @@ -596,7 +596,7 @@ exports[`User Component tests > Payments Page 1`] = `
<li>
<a
aria-current="page"
class="_button_f8f296 _button_e9c5ca _default_f8f296 _text_f8f296 _active_f8f296"
class="_button_f8f296 _button_e9c5ca _default_f8f296 _text_f8f296 _active_f8f296 "
href="/u/payments"
>
<div
Expand Down
8 changes: 4 additions & 4 deletions packages/ui-react/src/styles/_theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ $card-loading-bg-color: $secondary-color !default;

// FormFeedback

$form-feedback-error-bg-color: #ff0c3e !default;
$form-feedback-error-color: variables.$white !default;
$form-feedback-error-bg-color: #FF3535 !default;
$form-feedback-error-color: variables.$black !default;
$form-feedback-warning-bg-color: variables.$orange !default;
$form-feedback-warning-color: variables.$white !default;
$form-feedback-success-bg-color: variables.$green !default;
Expand All @@ -86,13 +86,13 @@ $text-field-hover-bg-color: rgba(variables.$white, 0.08) !default;
$text-field-active-color: variables.$white !default;
$text-field-active-border-color: variables.$white !default;
$text-field-placeholder-color: rgba(variables.$white, 0.7) !default;
$text-field-error-color: #ff0c3e !default;
$text-field-error-color: #FF3535 !default;

// Input

$input-resting-border-color: rgba(variables.$white, 0.34) !default;
$input-hover-border-color: rgba(variables.$white, 0.7) !default;
$input-field-error-color: #ff0c3e !default;
$input-field-error-color: #FF3535 !default;

// Toggle

Expand Down
2 changes: 1 addition & 1 deletion platforms/web/test-e2e/tests/register_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function runTestSuite(config: typeof testConfigs.svod, providerName: string) {
return;
}

I.seeCssPropertiesOnElements('input[name="terms"]', { 'border-color': '#ff0c3e' });
I.seeCssPropertiesOnElements('input[name="terms"]', { 'border-color': '#FF3535' });
});

Scenario(`I get warned for duplicate users - ${providerName}`, async ({ I }) => {
Expand Down
2 changes: 1 addition & 1 deletion platforms/web/test-e2e/utils/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function checkField(I: CodeceptJS.I, field, error: string | boolean = fal
// If error === true, there's an error, but no associated message
if (error && error !== true) {
I.see(error, `[data-testid=login-${field}-input]`);
I.seeCssPropertiesOnElements(`[data-testid="login-${field}-input"] [class*=helperText]`, { color: '#ff0c3e' });
I.seeCssPropertiesOnElements(`[data-testid="login-${field}-input"] [class*=helperText]`, { color: '#FF3535' });
} else {
I.dontSeeElement(`[class*=helperText] [data-testid="${field}-input"]`);
}
Expand Down

0 comments on commit 0e18789

Please sign in to comment.