Skip to content

Commit

Permalink
change(ContextNavigation): accessibility updates, not restructuring o…
Browse files Browse the repository at this point in the history
…f the volto component
  • Loading branch information
tarantilis committed Mar 28, 2023
1 parent dad8cb6 commit 03fe83d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
22 changes: 18 additions & 4 deletions src/ui/ContextNavigation/ContextNavigation.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,15 @@ function Template({ ...args }) {
return (
<Container>
<nav className="context-navigation">
<div className="context-navigation-header">
<div className="context-navigation-header" id="Navigation">
{args?.header ? <a href="/#">{args?.header}</a> : 'Navigation'}
</div>
<div role="list" className="ui list">
<div role="list" className="ui list" aria-labelledby="Navigation">
{args.sidenavItems &&
args.sidenavItems.map((element, index) => {
return (
<div
key={index}
role="listitem"
className={
(element.is_current ? 'active ' : '') +
Expand All @@ -142,6 +143,7 @@ function Template({ ...args }) {
>
<div className="content">
<a
id={element['@id']}
title={element.title}
className={
element?.items?.length > 0
Expand All @@ -155,7 +157,12 @@ function Template({ ...args }) {
{element?.items?.length > 0
? element.items.map((subelement, index) => {
return (
<div className="list" role="list">
<div
className="list"
role="list"
key={index}
aria-labelledby={element['@id']}
>
<div
role="listitem"
className={
Expand All @@ -166,6 +173,7 @@ function Template({ ...args }) {
>
<div className="content">
<a
id={subelement['@id']}
title={subelement.title}
className="contenttype-document"
href={subelement.url}
Expand All @@ -176,7 +184,12 @@ function Template({ ...args }) {
subelement.items.map(
(subparelement, index) => {
return (
<div className="list" role="list">
<div
className="list"
role="list"
key={index}
aria-labelledby={subelement['@id']}
>
<div
role="listitem"
className={
Expand All @@ -187,6 +200,7 @@ function Template({ ...args }) {
>
<div className="content">
<a
id={subparelement['@id']}
title={subparelement.title}
className="contenttype-document"
href={subparelement.url}
Expand Down
6 changes: 4 additions & 2 deletions theme/themes/eea/extras/contextNavigation.less
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
font-weight: @sidenavItemFontWeight;
color : @sidenavItemColor;

&:hover {
&:hover,
&:focus-visible {
background: @sidenavItemHoverBackground;
color : @sidenavItemHoverColor;
}
Expand Down Expand Up @@ -92,7 +93,8 @@
color: @sidenavItemActiveColor;
font-weight: @sidenavItemActiveFontWeight;
}
.context-navigation .active.item > .content > a:hover {
.context-navigation .active.item > .content > a:hover,
.context-navigation .active.item > .content > a:focus-visible {
color : @sidenavItemActiveColorHover;
}

Expand Down
2 changes: 1 addition & 1 deletion theme/themes/eea/extras/contextNavigation.variables
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@sidenavBackground: @grey-0;
@sidenavMarginRight: @rem-space-4;
@sidenavPaddingLeft: @rem-space-4;
@sidenavOverflow: hidden;
@sidenavOverflow: inherit;
@sidenavMargin: @rem-space-8 auto;

/* Header */
Expand Down

0 comments on commit 03fe83d

Please sign in to comment.