Skip to content

Commit

Permalink
Set base high z-index (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
wa-rren-dev authored Nov 23, 2021
1 parent 482e52e commit f6352a7
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 37 deletions.
4 changes: 3 additions & 1 deletion src/Common.module.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import 'Header/header-settings';

.link .tooltip {
clip: rect(1px 1px 1px 1px);
clip: rect(1px, 1px, 1px, 1px);
Expand All @@ -18,7 +20,7 @@
padding: rem(0 $nds-spacing-x-small);
position: absolute;
width: auto;
z-index: 1;
z-index: $base-z-index;
}

.visuallyHidden {
Expand Down
68 changes: 42 additions & 26 deletions src/Footer/Services/Services.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,14 @@ export default class Services extends Component {
<nav className={styles.wrapper} aria-label="Our services">
<ul className={styles.list}>
{links.external.map(
function ({ href, id, text, abbreviation, title }) {
return (
<li key={id}>
<TrackedLink
href={href}
eventAction={footerClickEventAction}
eventLabel={text}
aria-current={id == this.props.service ? "true" : null}
className={styles.link}
>
{abbreviation ? (
<>
<abbr title={title}>
{text}{" "}
<span className={styles.visuallyHidden}>{title}</span>
</abbr>
<span aria-hidden="true" className={styles.tooltip}>
{title}
</span>
</>
) : (
text
)}
</TrackedLink>
</li>
);
function (link) {
if (link.nestedLinks) {
return link.nestedLinks.map((nestedLink) => {
return <FooterLink key={nestedLink.id} {...nestedLink} />;
});
} else {
return <FooterLink key={link.id} {...link} />;
}
}.bind(this)
)}
</ul>
Expand All @@ -46,6 +28,40 @@ export default class Services extends Component {
}
}

FooterLink.propTypes = {
href: PropTypes.string,
id: PropTypes.string,
text: PropTypes.string,
abbreviation: PropTypes.string,
title: PropTypes.string,
};

function FooterLink({ href, text, abbreviation, title }) {
return (
<li>
<TrackedLink
href={href}
eventAction={footerClickEventAction}
eventLabel={text}
className={styles.link}
>
{abbreviation ? (
<>
<abbr title={title}>
{text} <span className={styles.visuallyHidden}>{title}</span>
</abbr>
<span aria-hidden="true" className={styles.tooltip}>
{title}
</span>
</>
) : (
text
)}
</TrackedLink>
</li>
);
}

Services.propTypes = {
service: PropTypes.string,
};
2 changes: 1 addition & 1 deletion src/Header/Account/Account.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
position: absolute;
right: 0;
top: 100%;
z-index: 1;
z-index: $base-z-index;

// We move focus when we expand via keyboard navigation
&:focus {
Expand Down
4 changes: 2 additions & 2 deletions src/Header/Header.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
box-sizing: border-box;
font-family: unquote($nds-font-family-sans);
position: relative;
z-index: 2;
z-index: $base-z-index;

*,
*:before,
Expand Down Expand Up @@ -131,7 +131,7 @@
position: fixed;
top: 0;
width: 100vw;
z-index: 2;
z-index: $base-z-index;
}

.header {
Expand Down
2 changes: 1 addition & 1 deletion src/Header/Nav/Nav.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ a.link,
color: $colour-nav-text;
outline: rem($nds-spacing-x-small) solid $nds-colour-focus-inverse;
outline-offset: rem(-$nds-spacing-small);
z-index: 1; // Push above the adjacent nav items
z-index: $base-z-index + 1; // Push above the adjacent nav items
}

&:active,
Expand Down
2 changes: 1 addition & 1 deletion src/Header/Nav/NavLinks/NavLinks.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ button.link {
left: 0;
position: relative;
width: 100%;
z-index: 1;
z-index: $base-z-index;

&.active {
display: block;
Expand Down
6 changes: 3 additions & 3 deletions src/Header/Search/Autocomplete/Autocomplete.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
margin: 0 !important;
max-width: 100% !important;
position: relative;
z-index: 101;
z-index: $base-z-index + 1;

&:focus {
outline: 3px solid $nds-colour-focus;
outline-offset: -3px;
z-index: 1;
z-index: $base-z-index - 1;
}

&::placeholder {
Expand Down Expand Up @@ -103,7 +103,7 @@
left: 0;
position: absolute;
top: 100%;
z-index: 100;
z-index: $base-z-index;
}

.autocomplete__menu--inline {
Expand Down
2 changes: 1 addition & 1 deletion src/Header/Search/Search.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
right: 0;
text-align: center;
top: 0;
z-index: 101; // To sit above the search box so the focus outline surrounds the button
z-index: $base-z-index + 2; // To sit above the search box so the focus outline surrounds the button

&:focus {
@include nds-default-focus-style;
Expand Down
3 changes: 2 additions & 1 deletion src/Header/SkipLink/SkipLink.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import '~@nice-digital/nds-core/scss/core';
@import '../header-settings';

.link {
clip: rect(1px 1px 1px 1px);
Expand All @@ -22,6 +23,6 @@
top: rem($nds-spacing-x-small);
white-space: nowrap;
width: auto;
z-index: 5;
z-index: $base-z-index + 5;
}
}
2 changes: 2 additions & 0 deletions src/Header/_header-settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ $colour-nav-background: $nds-colour-nice-teal;
$colour-nav-text: $nds-colour-text-inverse;

$search-height: 40;

$base-z-index: 99990;

0 comments on commit f6352a7

Please sign in to comment.