Skip to content

Commit

Permalink
Keyboard focus fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shyusu4 committed Feb 12, 2025
1 parent e158d24 commit 56d91ae
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
</li>
{% for gchild in child.value.child_links %}
<li class="sub-nav-mobile__item">
<a class="sub-nav-mobile__link sub-nav-mobile__link--no-children" href="{{ gchild.value.url }}">
{{ gchild.value.text }}
<a class="sub-nav-mobile__link" href="{{ gchild.value.url }}">
<span class="sub-nav-mobile__link-text">{{ gchild.value.text }}</span>
{% include "patterns/atoms/icons/icon.html" with name="arrow" classname="sub-nav-mobile__icon" %}
</a>
</li>
{% endfor %}
{% if child.value.section_link %}
<li class="sub-nav-mobile__item">
<a class="sub-nav-mobile__link sub-nav-mobile__link--no-children" href="{{ child.value.section_link.url }}">
{% firstof child.value.section_link_text child.value.section_link %}
<a class="sub-nav-mobile__link" href="{{ child.value.section_link.url }}">
<span class="sub-nav-mobile__link-text">{% firstof child.value.section_link_text child.value.section_link %}</span>
{% include "patterns/atoms/icons/icon.html" with name="arrow" classname="sub-nav-mobile__icon" %}
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
{% for child in links %}
{% if child.block_type == "link" %}
<li class="sub-nav-mobile__item">
<a href="{{ child.value.url }}" class="sub-nav-mobile__link sub-nav-mobile__link--no-children">
{{ child.value.text }}
<a href="{{ child.value.url }}" class="sub-nav-mobile__link">
<span class="sub-nav-mobile__link-text">{{ child.value.text }}</span>
{% include "patterns/atoms/icons/icon.html" with name="arrow" classname="sub-nav-mobile__icon" %}
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
<ul class="secondary-nav-mobile__list" data-secondary-nav>
{% for block in page.navigation_set.navigation %}
{% if block.block_type == "link" %}
<li class="secondary-nav-mobile__item">
<a href="{{ block.value.url }}" class="secondary-nav-mobile__link secondary-nav-mobile__link--no-children">
{{ block.value.text }}
<li class="secondary-nav-mobile__item secondary-nav-mobile__item--no-children">
<a href="{{ block.value.url }}" class="secondary-nav-mobile__link secondary-nav-mobile__link--no-children" {% if forloop.last %}data-last-menu-item-mobile{% endif %}>
<span class="secondary-nav-mobile__link-text">
{{ block.value.text }}
</span>
{% include "patterns/atoms/icons/icon.html" with name="arrow" classname="secondary-nav-mobile__icon" %}
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ tags:
primarynavmobile:
'':
template_name: 'patterns/navigation/components/primary-nav-mobile.html'
secondarynav:
'':
template_name: 'patterns/navigation/components/secondary-nav.html'
secondarynavmobile:
'':
template_name: 'patterns/navigation/components/secondary-nav-mobile.html'
pageurl:
link:
raw: '#'
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,28 @@ Styles for the top level of the navigation at mobile
border-bottom: 2px solid var(--color--light-border);
color: var(--color--link);

&:focus {
@include focus-style();
}

&--has-children {
justify-content: space-between;
}
}

&--no-children {
@include link-styles(
$color: var(--color--link),
$interaction-color: var(--color--theme-primary),
$underline-color: var(--color--link)
);
// top level menu link text for items with no children
&__link-text {
@include link-styles(
$color: var(--color--link),
$interaction-color: var(--color--theme-primary),
$underline-color: var(--color--link)
);

&:hover {
transition: color $transition-quick;
&:hover {
transition: color $transition-quick;

@include reduced-motion() {
transition: none;
}
@include reduced-motion() {
transition: none;
}
}
}
Expand Down
33 changes: 17 additions & 16 deletions tbx/static_src/sass/components/navigation/_sub-nav-mobile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,6 @@ Styles for the lower levels of the navigation at mobile
justify-content: space-between;
}

&--no-children {
@include link-styles(
$color: var(--color--link),
$interaction-color: var(--color--theme-primary),
$underline-color: var(--color--link)
);

&:hover {
transition: color $transition-quick;

@include reduced-motion() {
transition: none;
}
}
}

&--parent {
color: var(--color--heading);
font-weight: $weight--semibold;
Expand All @@ -87,6 +71,23 @@ Styles for the lower levels of the navigation at mobile
}
}

// 2nd and 3rd level link text for items with no children
&__link-text {
@include link-styles(
$color: var(--color--link),
$interaction-color: var(--color--theme-primary),
$underline-color: var(--color--link)
);

&:hover {
transition: color $transition-quick;

@include reduced-motion() {
transition: none;
}
}
}

&__icon {
@include arrow-link-icon-styles(
$width: 18px,
Expand Down

0 comments on commit 56d91ae

Please sign in to comment.