feat: hover Coordinator menu; pages named by their own heading
- The Coordinator pill is a real link to Shifts (/admin) and opens the Shifts / Contacts / Settings card on hover or keyboard focus (desktop). Esc closes it. Phones and tablets keep the second row in the menu overlay. - Menu links no longer scale on hover, so the blue highlight stays inside the card. - No gold "current page" line in the menu, the phone row, or the pill; aria-current stays for screen readers. The page heading shows where you are. - The dashboard heading and title are "Shifts". Breadcrumbs start at their section: Shifts > ..., Contacts > Name, Settings > Administrators. - tests: admins.test.ts updated for the new markup.
This commit is contained in:
1 parent
c576613b9d
commit
bf3724d531
6 files changed
+49
-101
No files matched your search
+22
-84
@@ -445,39 +445,12 @@ a.btn:active {
|
||||
content: none;
|
||||
}
|
||||
|
||||
/* Coordinator dropdown in the session bar, signed in. Same pattern as the view menu: a white card under the pill. */
|
||||
/* Coordinator menu in the session bar, signed in. A real pill link with the three sections in a card; opens on hover on desktop. */
|
||||
.session-bar .coord-menu {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.session-bar .coord-menu > summary {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 44px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
background: transparent;
|
||||
color: #222;
|
||||
font: inherit;
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
|
||||
.session-bar .coord-menu > summary::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.session-bar .coord-menu > summary::marker {
|
||||
content: "";
|
||||
}
|
||||
|
||||
.session-bar .coord-menu > summary::after {
|
||||
.session-bar .coord-menu > a::after {
|
||||
content: "";
|
||||
width: 0.4rem;
|
||||
height: 0.4rem;
|
||||
@@ -487,39 +460,17 @@ a.btn:active {
|
||||
transform: translateY(-0.12rem) rotate(45deg);
|
||||
}
|
||||
|
||||
.session-bar .coord-menu[open] > summary::after {
|
||||
.session-bar .coord-menu:hover > a::after,
|
||||
.session-bar .coord-menu:focus-within > a::after {
|
||||
transform: translateY(0.12rem) rotate(225deg);
|
||||
}
|
||||
|
||||
.session-bar .coord-menu > summary:hover,
|
||||
.session-bar .coord-menu > summary:active {
|
||||
transform: scale(1.1);
|
||||
background: transparent;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
/* On a coordinator page the pill is bold with the same gold line as the session-bar links. */
|
||||
.session-bar .coord-menu > summary.session-here {
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.session-bar .coord-menu > summary.session-here::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 7px;
|
||||
height: 2px;
|
||||
border-radius: 999px;
|
||||
background: var(--hope-gold);
|
||||
}
|
||||
|
||||
.coord-menu-list {
|
||||
position: absolute;
|
||||
z-index: 1001;
|
||||
top: calc(100% + 0.35rem);
|
||||
right: 0;
|
||||
display: grid;
|
||||
display: none;
|
||||
min-width: 9.5rem;
|
||||
padding: 0.3rem;
|
||||
background: #fff;
|
||||
@@ -528,6 +479,21 @@ a.btn:active {
|
||||
box-shadow: var(--hope-shadow);
|
||||
}
|
||||
|
||||
/* Invisible bridge over the gap, so the card stays open while the pointer crosses it. */
|
||||
.coord-menu-list::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -0.5rem;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 0.5rem;
|
||||
}
|
||||
|
||||
.session-bar .coord-menu:hover .coord-menu-list,
|
||||
.session-bar .coord-menu:focus-within .coord-menu-list {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.coord-menu-list a {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
@@ -543,28 +509,15 @@ a.btn:active {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* The session-bar links scale up on hover; the menu links must not, so the highlight stays inside the card. */
|
||||
.coord-menu-list a:hover,
|
||||
.coord-menu-list a:active {
|
||||
transform: none;
|
||||
background: var(--hope-blue-75);
|
||||
color: var(--hope-ink);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.coord-menu-list a[aria-current] {
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.coord-menu-list a[aria-current]::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0.8rem;
|
||||
right: 0.8rem;
|
||||
bottom: 9px;
|
||||
height: 2px;
|
||||
border-radius: 999px;
|
||||
background: var(--hope-gold);
|
||||
}
|
||||
|
||||
/* Phone and tablet: no dropdown inside the ☰ menu, a second plain row instead. Hidden on desktop. */
|
||||
.session-sections {
|
||||
display: none;
|
||||
@@ -4381,21 +4334,6 @@ button.btn-quiet::before {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.session-sections a[aria-current] {
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.session-sections a[aria-current]::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 7px;
|
||||
height: 2px;
|
||||
border-radius: 999px;
|
||||
background: var(--hope-gold);
|
||||
}
|
||||
|
||||
.header.nav-open ~ main .session-bar {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
|
||||
+12
-1
@@ -2,6 +2,7 @@
|
||||
bindNav();
|
||||
bindCalendar();
|
||||
bindViewMenu();
|
||||
bindCoordMenu();
|
||||
bindManage();
|
||||
bindSignupDates();
|
||||
document.querySelectorAll('[data-contact]').forEach(bindContact);
|
||||
@@ -27,7 +28,7 @@
|
||||
}
|
||||
|
||||
function bindViewMenu() {
|
||||
var menus = document.querySelectorAll('details.view-menu, details.manage-menu, details.coord-menu');
|
||||
var menus = document.querySelectorAll('details.view-menu, details.manage-menu');
|
||||
if (!menus.length) return;
|
||||
document.addEventListener('click', function (event) {
|
||||
for (var i = 0; i < menus.length; i += 1) {
|
||||
@@ -41,6 +42,16 @@
|
||||
});
|
||||
}
|
||||
|
||||
function bindCoordMenu() {
|
||||
var menu = document.querySelector('.coord-menu');
|
||||
if (!menu) return;
|
||||
menu.addEventListener('keydown', function (event) {
|
||||
if (event.key !== 'Escape') return;
|
||||
var active = document.activeElement;
|
||||
if (active && menu.contains(active)) active.blur();
|
||||
});
|
||||
}
|
||||
|
||||
function bindCalendar() {
|
||||
var calendar = document.querySelector('.shift-calendar');
|
||||
var weeks = document.querySelectorAll('.cal-week');
|
||||
|
||||
Reference in new issue
Block a user