-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added structured data markup and aria labels to site navigation #3539
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,8 +1,9 @@ | ||||||
<template> | ||||||
<div class="mobile-navigation" :class="{ 'open': isMobileNavigationOpen }"> | ||||||
<div class="mobile-navigation" :class="{ 'open': isMobileNavigationOpen }" id="mobile-navigation-wrapper" | ||||||
aria-labelledby="mobile-navigation-toggler" itemscope itemtype="https://schema.org/SiteNavigationElement" role="menu"> | ||||||
<div v-show="isNavigationInitialized"> | ||||||
<ul class="breadcrumb d-block px-3 py-0"> | ||||||
<li class="btn-close" @click="closeNavigation()"></li> | ||||||
<li class="btn-close" @click="closeNavigation()" :aria-label="$translate('Ceres::Template.closeIcon')"></li> | ||||||
|
||||||
<li class="breadcrumb-item" @click="slideTo(null, true)"> | ||||||
<i class="fa fa-home" aria-hidden="true"></i> | ||||||
|
@@ -20,7 +21,7 @@ | |||||
</li> | ||||||
|
||||||
<li class="ddown" v-for="category in dataContainer1.categories"> | ||||||
<a :href="getCategoryUrl(category.url)">{{ category.details[0].name }}</a> | ||||||
<a :href="getCategoryUrl(category.url)" itemprop="name" role="menuitem">{{ category.details[0].name }}</a> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we change the role to navigation we don't need to set the role to the child anymore, as links with navigation have the implicit roles of "link" which is correct semantic role for navigation items.
Suggested change
|
||||||
<span class="nav-direction" v-if="category.childCount" @click="slideTo(category)"> | ||||||
<i class="fa fa-lg fa-caret-right" aria-hidden="true"></i> | ||||||
</span> | ||||||
|
@@ -45,7 +46,7 @@ | |||||
</li> | ||||||
|
||||||
<li class="ddown" v-for="category in dataContainer2.categories"> | ||||||
<a :href="getCategoryUrl(category.url)">{{ category.details[0].name }}</a> | ||||||
<a :href="getCategoryUrl(category.url)" itemprop="name" role="menuitem">{{ category.details[0].name }}</a> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
<span class="nav-direction" v-if="category.childCount" @click="slideTo(category)"> | ||||||
<i class="fa fa-lg fa-caret-right" aria-hidden="true"></i> | ||||||
</span> | ||||||
|
@@ -65,7 +66,7 @@ | |||||
|
||||||
<template v-if="!isNavigationInitialized"> | ||||||
<ul class="breadcrumb"> | ||||||
<li class="btn-close" @click="closeNavigation()"></li> | ||||||
<li class="btn-close" @click="closeNavigation()" :aria-label="$translate('Ceres::Template.closeIcon')"></li> | ||||||
|
||||||
<li class="breadcrumb-item"> | ||||||
<i class="fa fa-home" aria-hidden="true"></i> | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,11 +7,13 @@ | |||||||||||||||||||||
{% for child in category.children if counter < maxItems[level] %} | ||||||||||||||||||||||
{% if (child.details | length > 0) %} | ||||||||||||||||||||||
{% if level == 1 %} | ||||||||||||||||||||||
<li><ul class="collapse-inner"> | ||||||||||||||||||||||
<li role="presentation"><ul class="collapse-inner"> | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
{% endif %} | ||||||||||||||||||||||
<li class="level{{ level }}"> | ||||||||||||||||||||||
{% set newScope = currentScopeUrl ~ "/" ~ child.details[0].nameUrl %} | ||||||||||||||||||||||
<a @touchstart.stop href="{{ newScope }}{{ urls.trailingSlashSuffix }}">{{ child.details[0].name }}</a> | ||||||||||||||||||||||
<a @touchstart.stop href="{{ newScope }}{{ urls.trailingSlashSuffix }}" itemprop="name" role="menuitem"> | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
{{ child.details[0].name }} | ||||||||||||||||||||||
</a> | ||||||||||||||||||||||
</li> | ||||||||||||||||||||||
{% if child.children %} | ||||||||||||||||||||||
{{ childlist.get_children(child, newScope, level + 1, megaMenuLevels, maxItems) }} | ||||||||||||||||||||||
|
@@ -49,18 +51,22 @@ | |||||||||||||||||||||
|
||||||||||||||||||||||
{% if category.children and translatedChildren > 0 %} | ||||||||||||||||||||||
|
||||||||||||||||||||||
<li {% if maxItemsPerStage[1] > 0 %}class="ddown"{% endif %} v-navigation-touch-handler> | ||||||||||||||||||||||
<a href="{{ currentScopeUrl }}{{ urls.trailingSlashSuffix }}">{{ category.details[0].name }}</a> | ||||||||||||||||||||||
<li {% if maxItemsPerStage[1] > 0 %}class="ddown"{% endif %} v-navigation-touch-handler role="presentation"> | ||||||||||||||||||||||
<a href="{{ currentScopeUrl }}{{ urls.trailingSlashSuffix }}" itemprop="name" role="menuitem"> | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
{{ category.details[0].name }} | ||||||||||||||||||||||
</a> | ||||||||||||||||||||||
{% if maxItemsPerStage[1] > 0 %} | ||||||||||||||||||||||
<ul data-level="1" class="collapse nav-dropdown-{{ counter }}"> | ||||||||||||||||||||||
<ul data-level="1" class="collapse nav-dropdown-{{ counter }}" role="menu" aria-label="{{ category.details[0].name }}"> | ||||||||||||||||||||||
{% set counter = counter + 1 %} | ||||||||||||||||||||||
{% if megaMenuLevels == 1 %} | ||||||||||||||||||||||
{% for child in category.children %} | ||||||||||||||||||||||
{% if child.details | length > 0 %} | ||||||||||||||||||||||
<li> | ||||||||||||||||||||||
<li role="presentation"> | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
<ul class="collapse-inner"> | ||||||||||||||||||||||
<li> | ||||||||||||||||||||||
<a href="{{ currentScopeUrl }}/{{ child.details[0].nameUrl }}{{ urls.trailingSlashSuffix }}">{{ child.details[0].name }}</a> | ||||||||||||||||||||||
<a href="{{ currentScopeUrl }}/{{ child.details[0].nameUrl }}{{ urls.trailingSlashSuffix }}" itemprop="name" role="menuitem"> | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
{{ child.details[0].name }} | ||||||||||||||||||||||
</a> | ||||||||||||||||||||||
</li> | ||||||||||||||||||||||
</ul> | ||||||||||||||||||||||
</li> | ||||||||||||||||||||||
|
@@ -75,8 +81,10 @@ | |||||||||||||||||||||
|
||||||||||||||||||||||
{% else %} | ||||||||||||||||||||||
|
||||||||||||||||||||||
<li> | ||||||||||||||||||||||
<a href="{{ currentScopeUrl }}{{ urls.trailingSlashSuffix }}">{{ category.details[0].name }}</a> | ||||||||||||||||||||||
<li role="presentation"> | ||||||||||||||||||||||
<a href="{{ currentScopeUrl }}{{ urls.trailingSlashSuffix }}" itemprop="name" role="menuitem"> | ||||||||||||||||||||||
{{ category.details[0].name }} | ||||||||||||||||||||||
</a> | ||||||||||||||||||||||
</li> | ||||||||||||||||||||||
Comment on lines
+84
to
88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
{% endif %} | ||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -12,7 +12,13 @@ | |||||
<img alt="{{ companyName }}" src="{{ companyLogo }}" class="img-fluid" /> | ||||||
</a> | ||||||
{% endif %} | ||||||
<button v-open-mobile-navigation class="navbar-toggler d-lg-none p-3" type="button"> | ||||||
<button v-open-mobile-navigation | ||||||
class="navbar-toggler d-lg-none p-3" | ||||||
type="button" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Wouldn't |
||||||
id="mobile-navigation-toggler" | ||||||
for="mobile-navigation-wrapper" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I don't think the |
||||||
aria-controls="menu" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't this only work if there was an interactive element with id="menu" ? |
||||||
aria-label="{{ trans("Ceres::Template.menuLabel") }}"> | ||||||
☰ | ||||||
</button> | ||||||
</div> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to ARIA best practices,
role="menu"
should typically be used for desktop applications menus, not for website navigation.For website navigation
role="navigation"
or native<nav>
is more appropriate.