Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/guidance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ export function addGuidanceControl(
panelEl = c;
L.DomEvent.disableClickPropagation(c);
L.DomEvent.disableScrollPropagation(c);
// Delegate clicks on .guidance-btn to a single persistent listener so
// every-GPS-fix re-renders don't destroy the button mid-tap.
L.DomEvent.on(c, 'click', (e: Event) => {
if ((e.target as HTMLElement).closest('.guidance-btn')) onStop();
});
render();
return c;
},
Expand Down Expand Up @@ -386,10 +391,11 @@ function render(): void {
function appendButton(label: string, modifier: string, ariaLabel: string): void {
if (!panelEl) return;
const btn = document.createElement('button');
btn.type = 'button';
btn.className = `guidance-btn ${modifier}`;
btn.textContent = label;
btn.setAttribute('aria-label', ariaLabel);
btn.addEventListener('click', onStop);
// Click handling lives on panelEl via delegation — see addGuidanceControl.
panelEl.appendChild(btn);
}

Expand Down
Loading