Skip to content

Commit

Permalink
small improvements to breadcrumbs (#1207)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart Robson committed Oct 30, 2020
1 parent 4e7cada commit 214848e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
6 changes: 6 additions & 0 deletions components/vf-breadcrumbs/CHANGELOG.md
@@ -1,3 +1,9 @@
### 2.0.0

* adds `aria-current="location"` to be used for the last item in `vf-breadcrumbs`
* replaces CSS to style `aria-current="location"` and not `:last-of-type`.
* adds text-shadow to `aria-current="location"` to show text a little bolder.

### 1.0.5

* removes the bottom margin
Expand Down
14 changes: 11 additions & 3 deletions components/vf-breadcrumbs/vf-breadcrumbs--with-related.njk
Expand Up @@ -2,21 +2,29 @@

<ul class="vf-breadcrumbs__list | vf-list vf-list--inline">
{% for breadcrumb in breadcrumbs %}
<li class="vf-breadcrumbs__item">
<li class="vf-breadcrumbs__item"
{% if breadcrumb.currentPage %} aria-current="location"{%- endif -%}
>
{% if breadcrumb.breadcrumb_href %}
<a href="{{ breadcrumb.breadcrumb_href }}" class="vf-breadcrumbs__link">{{ breadcrumb.text }}</a>
<a href="{{ breadcrumb.breadcrumb_href }}" class="vf-breadcrumbs__link">
{{- breadcrumb.text -}}
</a>

{% else %}
{{ breadcrumb.text }}
{% endif %}

</li>

{% endfor %}

</ul>

{% if related %}
<span class="vf-breadcrumbs__heading">Related:</span>
<ul class="vf-breadcrumbs__list vf-breadcrumbs__list--related | vf-list vf-list--inline">
{% for item in related %}
<li class="vf-breadcrumbs__item">
<li class="vf-breadcrumbs__item"{%- if item.breadcrumb_last %} aria-current="location"{%- endif -%}>
<a href="{{ item.breadcrumb_href }}" class="vf-breadcrumbs__link">{{ item.text }}</a>
</li>
{% endfor %}
Expand Down
1 change: 1 addition & 0 deletions components/vf-breadcrumbs/vf-breadcrumbs.config.yml
Expand Up @@ -9,6 +9,7 @@ context:
- text: Topics
breadcrumb_href: JavaScript:Void(0);
- text: Centre
currentPage: true
related:
- text: Biscuits
breadcrumb_href: JavaScript:Void(0);
Expand Down
4 changes: 3 additions & 1 deletion components/vf-breadcrumbs/vf-breadcrumbs.njk
@@ -1,7 +1,9 @@
<nav class="vf-breadcrumbs" aria-label="Breadcrumb">
<ul class="vf-breadcrumbs__list | vf-list vf-list--inline">
{% for breadcrumb in breadcrumbs %}
<li class="vf-breadcrumbs__item">
<li class="vf-breadcrumbs__item"
{% if breadcrumb.currentPage %} aria-current="location"{%- endif -%}
>
{% if breadcrumb.breadcrumb_href %}
<a href="{{ breadcrumb.breadcrumb_href }}" class="vf-breadcrumbs__link">{{ breadcrumb.text }}</a>
{% else %}
Expand Down
5 changes: 4 additions & 1 deletion components/vf-breadcrumbs/vf-breadcrumbs.scss
Expand Up @@ -37,14 +37,17 @@
position: relative;


&:not(:last-of-type) {
&:not([aria-current]) {
&::after {
color: $vf-breadcrumbs__item-chevron--color;
content: '>';
display: inline-block;
margin-left: 3px;
}
}
&[aria-current] {
text-shadow: 1px 0 0;
}
}

.vf-breadcrumbs__heading {
Expand Down

0 comments on commit 214848e

Please sign in to comment.