Skip to content

Commit 4b14b2c

Browse files
committed
Grey triangle focus indicator on main nav (#360)
1 parent 5ccf2b2 commit 4b14b2c

File tree

4 files changed

+45
-14
lines changed

4 files changed

+45
-14
lines changed

srcmedia/scss/_mixins.scss

+6-6
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,14 @@
279279
}
280280
}
281281

282-
@mixin triangle-overlay($color) {
282+
@mixin triangle-overlay($color, $size) {
283283
height: 0;
284284
width: 0;
285-
left: calc(100% - 50px);
286-
border-right: 25px solid $color;
287-
border-bottom: 25px solid $color;
288-
border-top: 25px solid transparent;
289-
border-left: 25px solid transparent;
285+
left: calc(100% - #{$size});
286+
border-right: calc(#{$size} / 2) solid $color;
287+
border-bottom: calc(#{$size} / 2) solid $color;
288+
border-top: calc(#{$size} / 2) solid transparent;
289+
border-left: calc(#{$size} / 2) solid transparent;
290290
z-index: -1;
291291
opacity: 0.5;
292292
}

srcmedia/scss/snippets/_links.scss

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ a.archive-link { // "view the archive" button
3939
width: 30px;
4040
box-shadow: 0 0 6px 0 $french-blue;
4141
z-index: 10;
42+
text-decoration: none;
4243

4344
@media (min-width: $largeMonitor) {
4445
left: calc(50% + #{$largeMonitor} / 2 - 4rem);

srcmedia/scss/snippets/_nav.scss

+36-6
Original file line numberDiff line numberDiff line change
@@ -180,24 +180,54 @@
180180
}
181181

182182
&.about.triangle::before {
183-
@include triangle-overlay($rosy-pink);
183+
@include triangle-overlay($rosy-pink, 54px);
184184
}
185185

186186
&.editorial.active::before {
187-
@include triangle-overlay($twilight);
187+
@include triangle-overlay($twilight, 54px);
188188
}
189189

190190
&.collections,
191191
&.archive {
192192
&.active::before {
193-
@include triangle-overlay($seafoam-blue);
193+
@include triangle-overlay($seafoam-blue, 54px);
194194
}
195195
}
196+
197+
// grey hover/focus triangle overlay for main nav menu items
198+
&.collections,
199+
&.archive,
200+
&.editorial {
201+
&.focus::before,
202+
&:focus::before,
203+
&:hover::before {
204+
@include triangle-overlay($white, 54px);
205+
opacity: 1;
206+
}
207+
}
208+
}
209+
210+
// smaller hover/focus triangle for items in the about menu
211+
.submenu .item:focus-within::before,
212+
.about .item:hover::before {
213+
display: block;
214+
@include triangle-overlay($white, 40px);
215+
opacity: 1;
216+
}
217+
218+
// PPA logo/brand has smaller triangle shifted to the bottom; no hover
219+
.brand .item:focus::before,
220+
.brand .item.focus::before {
221+
top: 54px;
222+
@include triangle-overlay($white, 42px);
223+
opacity: 1;
196224
}
197225

198-
a.item:hover {
199-
border-bottom: 10px solid $french-blue;
200-
padding-bottom: 8px;
226+
// remove default outline focus indicator
227+
a.item:focus,
228+
a.item.focus,
229+
.item a:focus {
230+
outline: none;
201231
}
202232

203233
.search .search.icon {

templates/snippets/about.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{% load static %}
22

33
<div class="about ui simple item dropdown{% if active == 'about' %} triangle{% endif %}">
4-
<div tabindex=0 class="text">About</div>
4+
<div class="text">About</div>
55
<img class="dropdown icon" src="{% static 'img/icons/RightChevron.svg' %}" alt="">
6-
<div class="menu">
6+
<div class="menu submenu">
77
{# NOTE: currently relies on editorial not having show_in_menu set #}
88
{% for page in request.site.root_page.get_children.live.in_menu %}
99
<div class="item"><a href="{{ page.url }}">{{ page.title }}</a></div>

0 commit comments

Comments
 (0)