Theme Seebad 0.4.0: menu panels; fix missing chevron icons; render test for all themes
- Menu panels: arrow next to each main menu item opens a panel with the page description (SEO text), jump links to the headed sections and a cartouche with booking and phone; Escape/outside click closes, focus returns; without JavaScript the menu stays plain links - Header: booking button hidden between 1280 and 1535 px (too narrow with the arrows), desktop phone removed - Fix: offers carousel and menu used outline chevron icons that do not exist (500 as soon as offers are shown); now mini chevrons - New test: every installed theme renders all pages with reviews and offers in every display mode - Wish: menu photo per page (ZUSAMMENARBEIT §5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d9e52c4789
commit
d2f53ceb84
7 files changed
+178
-15
No files matched your search
@@ -6,3 +6,47 @@ import '../ostsee-licht/theme.js';
|
||||
|
||||
// Logo, favicon (resources/themes/seebad/img) – addressed in Blade via Vite::asset().
|
||||
import.meta.glob(['./img/**'], { eager: true, query: '?url' });
|
||||
|
||||
/**
|
||||
* Menu panels (partials/header): the arrow next to a menu item opens a panel with jump links into the page.
|
||||
* Without JavaScript the arrows stay hidden and the menu items are plain links.
|
||||
*/
|
||||
function initMenuPanels() {
|
||||
const header = document.querySelector('[data-menu]');
|
||||
const toggles = [...document.querySelectorAll('[data-menu-toggle]')];
|
||||
if (!header || toggles.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const panelOf = (toggle) => document.getElementById(toggle.getAttribute('aria-controls'));
|
||||
const close = (toggle) => {
|
||||
toggle.setAttribute('aria-expanded', 'false');
|
||||
panelOf(toggle).hidden = true;
|
||||
};
|
||||
|
||||
toggles.forEach((toggle) => {
|
||||
toggle.hidden = false;
|
||||
toggle.addEventListener('click', () => {
|
||||
const open = toggle.getAttribute('aria-expanded') === 'true';
|
||||
toggles.filter((other) => other !== toggle).forEach(close);
|
||||
toggle.setAttribute('aria-expanded', String(!open));
|
||||
panelOf(toggle).hidden = open;
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', (event) => {
|
||||
const open = toggles.find((toggle) => toggle.getAttribute('aria-expanded') === 'true');
|
||||
if (event.key === 'Escape' && open) {
|
||||
close(open);
|
||||
open.focus();
|
||||
}
|
||||
});
|
||||
document.addEventListener('click', (event) => {
|
||||
if (!header.contains(event.target)) {
|
||||
toggles.forEach(close);
|
||||
}
|
||||
});
|
||||
window.matchMedia('(min-width: 80rem)').addEventListener('change', () => toggles.forEach(close));
|
||||
}
|
||||
|
||||
initMenuPanels();
|
||||
Reference in new issue
Block a user