The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix: make the app keyboard-reachable, and close four DoS-able patterns
Maurice1ad2e92142a5
diff --git a/client/src/components/Admin/AddonManager.tsx b/client/src/components/Admin/AddonManager.tsxindex 7ae90b72e..c5ea9e6ce 100644--- a/client/src/components/Admin/AddonManager.tsx+++ b/client/src/components/Admin/AddonManager.tsx@@ -451,6 +451,7 @@ function LlmParsingConfig({ addon }: { addon: Addon }) {<section className="space-y-3"><div className={sectionCls}>Model</div><label className="block">+ <span className="sr-only">Model</span><input autoComplete="off" className={fieldCls} value={model} onChange={e => setModel(e.target.value)} placeholder={provider === 'anthropic' ? 'claude-opus-4-8' : provider === 'openai' ? 'gpt-4o' : 'select or pull below'} /></label>diff --git a/client/src/components/Admin/AdminMcpTokensPanel.tsx b/client/src/components/Admin/AdminMcpTokensPanel.tsxindex e2c55c86a..221f4da9c 100644--- a/client/src/components/Admin/AdminMcpTokensPanel.tsx+++ b/client/src/components/Admin/AdminMcpTokensPanel.tsx@@ -214,7 +214,12 @@ export default function AdminMcpTokensPanel() {{/* Revoke OAuth session modal */}{revokeConfirmId !== null && (<div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"- onClick={e => { if (e.target === e.currentTarget) setRevokeConfirmId(null) }}>+ role="button" tabIndex={0} aria-label={t('common.close')}+ onClick={e => { if (e.target === e.currentTarget) setRevokeConfirmId(null) }}+ onKeyDown={e => {+ if (e.target !== e.currentTarget) return+ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setRevokeConfirmId(null) }+ }}><div className="rounded-xl shadow-xl w-full max-w-sm p-6 space-y-4 bg-surface-card"><h3 className="text-base font-semibold text-content">{t('admin.oauthSessions.revokeTitle')}</h3><p className="text-sm text-content-secondary">{t('admin.oauthSessions.revokeMessage')}</p>@@ -235,7 +240,12 @@ export default function AdminMcpTokensPanel() {{/* Delete MCP token modal */}{deleteConfirmId !== null && (<div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"- onClick={e => { if (e.target === e.currentTarget) setDeleteConfirmId(null) }}>+ role="button" tabIndex={0} aria-label={t('common.close')}+ onClick={e => { if (e.target === e.currentTarget) setDeleteConfirmId(null) }}+ onKeyDown={e => {+ if (e.target !== e.currentTarget) return+ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setDeleteConfirmId(null) }+ }}><div className="rounded-xl shadow-xl w-full max-w-sm p-6 space-y-4 bg-surface-card"><h3 className="text-base font-semibold text-content">{t('admin.mcpTokens.deleteTitle')}</h3><p className="text-sm text-content-secondary">{t('admin.mcpTokens.deleteMessage')}</p>diff --git a/client/src/components/Admin/AdminPluginsPanel.tsx b/client/src/components/Admin/AdminPluginsPanel.tsxindex 30983414a..8a1630424 100644--- a/client/src/components/Admin/AdminPluginsPanel.tsx+++ b/client/src/components/Admin/AdminPluginsPanel.tsx@@ -799,7 +799,7 @@ export default function AdminPluginsPanel() {</div>)}{/* Click-away layer for any open dropdown (filters or a row's ⋯ menu). */}- {menu && <div className="fixed inset-0 z-20" onClick={() => setMenu(null)} />}+ {menu && <div role="presentation" className="fixed inset-0 z-20" onClick={() => setMenu(null)} />}{/* Header */}<div className="px-4 sm:px-6 pt-5"><div className="flex items-start justify-between gap-4">@@ -972,8 +972,8 @@ export default function AdminPluginsPanel() {{/* Error-log modal */}{errorsFor && (- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={() => setErrorsFor(null)}>- <div className="bg-surface-card border border-edge rounded-2xl w-full max-w-2xl max-h-[70vh] flex flex-col shadow-modal" onClick={e => e.stopPropagation()}>+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={() => setErrorsFor(null)}>+ <div role="presentation" className="bg-surface-card border border-edge rounded-2xl w-full max-w-2xl max-h-[70vh] flex flex-col shadow-modal" onClick={e => e.stopPropagation()}><div className="px-5 py-3.5 border-b border-edge-secondary flex items-center justify-between"><span className="text-sm font-semibold text-content flex items-center gap-2"><Bug size={15} /> {errorsFor.id} — {t('admin.plugins.errorLog')}</span><button type="button" onClick={() => setErrorsFor(null)} className="text-content-faint hover:text-content"><X size={16} /></button>@@ -994,8 +994,8 @@ export default function AdminPluginsPanel() {{/* Operator-supplied egress hosts */}{egressFor && (- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={() => setEgressFor(null)}>- <div className="bg-surface-card border border-edge rounded-2xl w-full max-w-lg shadow-modal" onClick={e => e.stopPropagation()}>+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={() => setEgressFor(null)}>+ <div role="presentation" className="bg-surface-card border border-edge rounded-2xl w-full max-w-lg shadow-modal" onClick={e => e.stopPropagation()}><div className="px-5 py-3.5 border-b border-edge-secondary flex items-center justify-between"><span className="text-sm font-semibold text-content flex items-center gap-2"><Globe size={15} /> {egressFor.id} — {t('admin.plugins.allowedHosts')}</span><button type="button" onClick={() => setEgressFor(null)} className="text-content-faint hover:text-content"><X size={16} /></button>@@ -1508,8 +1508,8 @@ function PluginDetailModal({ item, installed, busy, onInstall, onClose, t, localconst offer = installOffer(detail ?? item, t)return (- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={onClose}>- <div className="bg-surface-card border border-edge rounded-2xl w-full max-w-xl max-h-[88vh] overflow-auto shadow-modal" onClick={e => e.stopPropagation()}>+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={onClose}>+ <div role="presentation" className="bg-surface-card border border-edge rounded-2xl w-full max-w-xl max-h-[88vh] overflow-auto shadow-modal" onClick={e => e.stopPropagation()}><div className="relative"><Screenshot url={item.screenshotUrl} className="w-full aspect-[16/9]" iconSize={36} /><div className="absolute inset-0 bg-gradient-to-t from-black/50 to-transparent" />@@ -1610,7 +1610,7 @@ function PluginDetailModal({ item, installed, busy, onInstall, onClose, t, local<h4 className="text-[11px] font-semibold uppercase tracking-wider text-content-muted">{t('admin.plugins.detailsTitle')}</h4><div className="grid grid-cols-2 gap-x-6 gap-y-3 mt-2.5">{item.latest && <Meta k={t('admin.plugins.metaVersion')} v={`v${item.latest}`} />}- {sizeKb && <Meta k={t('admin.plugins.metaSize')} v={`${sizeKb} KB`} />}+ {sizeKb !== null && <Meta k={t('admin.plugins.metaSize')} v={`${sizeKb} KB`} />}{/* The range, not just its lower bound: "TREK 3.2.0+" reads as "and anythingnewer", which is exactly the claim a `<4.0.0` upper bound denies. */}{(item.trek || item.minTrekVersion) && (@@ -1760,8 +1760,8 @@ function SignatureBlockDialog({ data, entry, busy, t, onRetrust, onClose }: {: 'admin.plugins.sig.invalidBody'return (- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={onClose}>- <div className="bg-surface-card border border-edge rounded-2xl w-full max-w-md shadow-modal overflow-hidden" onClick={e => e.stopPropagation()}>+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={onClose}>+ <div role="presentation" className="bg-surface-card border border-edge rounded-2xl w-full max-w-md shadow-modal overflow-hidden" onClick={e => e.stopPropagation()}><div className="px-5 py-4 border-b border-edge-secondary flex items-start gap-3"><div className="w-9 h-9 rounded-lg bg-warning-soft grid place-items-center shrink-0"><ShieldAlert size={18} className="text-warning" /></div><div>@@ -1824,8 +1824,8 @@ function UpdateConsentDialog({ data, unsigned, t, onApprove, onLater }: {t: T; onApprove: () => void; onLater: () => void}) {return (- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={onLater}>- <div className="bg-surface-card border border-edge rounded-2xl w-full max-w-md shadow-modal overflow-hidden" onClick={e => e.stopPropagation()}>+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={onLater}>+ <div role="presentation" className="bg-surface-card border border-edge rounded-2xl w-full max-w-md shadow-modal overflow-hidden" onClick={e => e.stopPropagation()}><div className="px-5 py-4 border-b border-edge-secondary flex items-start gap-3"><div className="w-9 h-9 rounded-lg bg-warning-soft grid place-items-center shrink-0"><ShieldCheck size={18} className="text-warning" /></div><div>@@ -1884,8 +1884,8 @@ function DependencyResolveDialog({ data, t, busy, installedIds, onDownload, onCl...data.versionMismatch.map(d => ({ id: d.id, constraint: d.wanted, installed: d.installed })),]return (- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={onClose}>- <div className="bg-surface-card border border-edge rounded-2xl w-full max-w-md shadow-modal overflow-hidden" onClick={e => e.stopPropagation()}>+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={onClose}>+ <div role="presentation" className="bg-surface-card border border-edge rounded-2xl w-full max-w-md shadow-modal overflow-hidden" onClick={e => e.stopPropagation()}><div className="px-5 py-4 border-b border-edge-secondary flex items-start gap-3"><div className="w-9 h-9 rounded-lg bg-warning-soft grid place-items-center shrink-0"><Puzzle size={18} className="text-warning" /></div><div>diff --git a/client/src/components/Admin/BackupPanel.tsx b/client/src/components/Admin/BackupPanel.tsxindex 754cd276a..28ce06181 100644--- a/client/src/components/Admin/BackupPanel.tsx+++ b/client/src/components/Admin/BackupPanel.tsx@@ -318,9 +318,9 @@ export default function BackupPanel() {<div className="flex flex-col gap-5">{/* Enable toggle */}<label className="flex items-center justify-between gap-4 cursor-pointer">- <div className="min-w-0">- <span className="text-sm font-medium text-gray-900">{t('backup.auto.enable')}</span>- <p className="text-xs text-gray-500 mt-0.5">{t('backup.auto.enableHint')}</p>+ <div className="min-w-0 text-sm font-medium text-gray-900">+ {t('backup.auto.enable')}+ <p className="text-xs font-normal text-gray-500 mt-0.5">{t('backup.auto.enableHint')}</p></div><button type="button"onClick={() => handleAutoSettingsChange('enabled', !autoSettings.enabled)}@@ -458,11 +458,15 @@ export default function BackupPanel() {{/* Restore Warning Modal */}{restoreConfirm && (<div+ // Dismiss-on-backdrop is a mouse shortcut for the Cancel button below;+ // the backdrop itself carries no semantics of its own.+ role="presentation"className="bg-[rgba(0,0,0,0.5)]"style={{ position: 'fixed', inset: 0, zIndex: 9999, backdropFilter: 'blur(4px)', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}onClick={() => setRestoreConfirm(null)}><div+ role="presentation"onClick={e => e.stopPropagation()}style={{ width: '100%', maxWidth: 440, borderRadius: 16, overflow: 'hidden' }}className="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700"diff --git a/client/src/components/Admin/DefaultUserSettingsTab.tsx b/client/src/components/Admin/DefaultUserSettingsTab.tsxindex a9bd11fc9..e73523c05 100644--- a/client/src/components/Admin/DefaultUserSettingsTab.tsx+++ b/client/src/components/Admin/DefaultUserSettingsTab.tsx@@ -185,7 +185,7 @@ export default function DefaultUserSettingsTab(): React.ReactElement {transport_mode: null,website: null,phone: null,- created_at: Date(),+ created_at: String(new Date()),}], [])if (!loaded) {diff --git a/client/src/components/Admin/PackingTemplateManager.test.tsx b/client/src/components/Admin/PackingTemplateManager.test.tsxindex 293d60801..a315d6d74 100644--- a/client/src/components/Admin/PackingTemplateManager.test.tsx+++ b/client/src/components/Admin/PackingTemplateManager.test.tsx@@ -18,7 +18,7 @@ beforeEach(() => {resetAllStores();});-/** Template rows carry [chevron, edit, delete]; category headers [add item, edit, delete]. */+/** Template rows carry [chevron, name, edit, delete]; category headers [add item, edit, delete]. */function rowButtons(name: string, selector: string): HTMLElement[] {const row = screen.getByText(name).closest(selector) as HTMLElement;return within(row).getAllByRole('button');@@ -588,11 +588,11 @@ describe('PackingTemplateManager', () => {render(<><ToastContainer /><PackingTemplateManager /></>);await expandBeachTrip(user, 'Clothing');- await user.click(templateButtons('Beach Trip')[2]);+ await user.click(templateButtons('Beach Trip')[3]);expect(await screen.findByText('Failed to delete template')).toBeInTheDocument();expect(screen.getByText('Clothing')).toBeInTheDocument();- await user.click(templateButtons('Beach Trip')[2]);+ await user.click(templateButtons('Beach Trip')[3]);await screen.findByText('Template deleted');await waitFor(() => expect(screen.queryByText('Clothing')).not.toBeInTheDocument());expect(screen.getByText('No templates created yet')).toBeInTheDocument();@@ -611,14 +611,14 @@ describe('PackingTemplateManager', () => {render(<><ToastContainer /><PackingTemplateManager /></>);await screen.findByText('Beach Trip');- await user.click(templateButtons('Beach Trip')[1]);+ await user.click(templateButtons('Beach Trip')[2]);await user.clear(screen.getByDisplayValue('Beach Trip'));await user.type(screen.getByRole('textbox'), '{Enter}');await waitFor(() => expect(screen.getByText('Beach Trip')).toBeInTheDocument());expect(puts).toBe(0);// Blurring the field commits the pending name — here the request fails- await user.click(templateButtons('Beach Trip')[1]);+ await user.click(templateButtons('Beach Trip')[2]);const input = screen.getByDisplayValue('Beach Trip');await user.clear(input);await user.type(input, 'Winter');diff --git a/client/src/components/Admin/PackingTemplateManager.tsx b/client/src/components/Admin/PackingTemplateManager.tsxindex 2baa7313f..546757b32 100644--- a/client/src/components/Admin/PackingTemplateManager.tsx+++ b/client/src/components/Admin/PackingTemplateManager.tsx@@ -197,7 +197,7 @@ export default function PackingTemplateManager() {onKeyDown={e => { if (e.key === 'Enter') handleRenameTemplate(tmpl.id); if (e.key === 'Escape') setEditingTemplate(null) }}className="flex-1 px-2 py-0.5 border border-slate-300 rounded text-sm" />) : (- <span onClick={() => toggleExpand(tmpl.id)} className="flex-1 text-sm font-medium text-slate-700 cursor-pointer">{tmpl.name}</span>+ <button type="button" onClick={() => toggleExpand(tmpl.id)} className="flex-1 text-left bg-transparent border-0 p-0 text-sm font-medium text-slate-700 cursor-pointer">{tmpl.name}</button>)}<span className="text-xs text-slate-400 px-2 py-0.5 bg-slate-100 rounded-full">{tmpl.category_count} {t('admin.packingTemplates.categories')} · {tmpl.item_count} {t('admin.packingTemplates.items')}diff --git a/client/src/components/Budget/BudgetPanel.helpers.ts b/client/src/components/Budget/BudgetPanel.helpers.tsindex 9e183eda7..020aa33ea 100644--- a/client/src/components/Budget/BudgetPanel.helpers.ts+++ b/client/src/components/Budget/BudgetPanel.helpers.ts@@ -53,7 +53,7 @@ export function hexLighten(hex: string, amount: number): string {}export const fmtNum = (v: number | null | undefined, locale: string, cur: string) => {- if (v == null || isNaN(v)) return '-'+ if (v == null || Number.isNaN(v)) return '-'const d = currencyDecimals(cur)return Number(v).toLocaleString(locale, { minimumFractionDigits: d, maximumFractionDigits: d }) + ' ' + (SYMBOLS[cur] || cur)}diff --git a/client/src/components/Budget/BudgetPanelCategoryTable.test.tsx b/client/src/components/Budget/BudgetPanelCategoryTable.test.tsxindex 70e2cb923..16179733e 100644--- a/client/src/components/Budget/BudgetPanelCategoryTable.test.tsx+++ b/client/src/components/Budget/BudgetPanelCategoryTable.test.tsx@@ -586,7 +586,10 @@ describe('BudgetCategoryTable — member chips', () => {it('FE-W4BCT-052: picking a member from either chip dropdown sets the item members', () => {const { setBudgetItemMembers, container } = withMembers()// The mobile stack under the name and the persons column both carry an editor.- const editors = container.querySelectorAll('td button')+ // Assigned chips are buttons of their own, so the editors are the two that+ // carry the picker icon.+ const editors = Array.from(container.querySelectorAll('td button'))+ .filter(b => b.querySelector('.lucide-pencil, .lucide-users'))fireEvent.click(editors[0])fireEvent.click(screen.getByText('bob'))diff --git a/client/src/components/Budget/BudgetPanelInlineEditCell.tsx b/client/src/components/Budget/BudgetPanelInlineEditCell.tsxindex a5c6bcd9e..232936775 100644--- a/client/src/components/Budget/BudgetPanelInlineEditCell.tsx+++ b/client/src/components/Budget/BudgetPanelInlineEditCell.tsx@@ -23,7 +23,7 @@ export default function InlineEditCell({ value, onSave, type = 'text', style = {const save = () => {setEditing(false)let v: string | number | null = editValue- if (type === 'number') { const p = Number.parseFloat(String(editValue).replace(',', '.')); v = isNaN(p) ? null : p }+ if (type === 'number') { const p = Number.parseFloat(String(editValue).replace(',', '.')); v = Number.isNaN(p) ? null : p }if (v !== value) onSave(v)}@@ -45,14 +45,27 @@ export default function InlineEditCell({ value, onSave, type = 'text', style = {? Number(value).toLocaleString(locale, { minimumFractionDigits: decimals, maximumFractionDigits: decimals }): (value || '')+ // Editable cells are real buttons so they can be tabbed to and pressed. A+ // read-only cell renders no control at all rather than a disabled one: it is+ // plain text, and a disabled button would be announced as an unavailable+ // control that never becomes available. Same split the member chips use.+ const cellStyle: React.CSSProperties = {+ padding: '2px 4px', borderRadius: 4, minHeight: 22, display: 'flex', alignItems: 'center',+ justifyContent: style?.textAlign === 'center' ? 'center' : 'flex-start', transition: 'background 0.15s',+ color: display ? 'var(--text-primary)' : 'var(--text-faint)', fontSize: 'calc(13px * var(--fs-scale-body, 1))',+ width: '100%', textAlign: 'left', ...style,+ }+ const content = display || placeholder || '-'++ if (readOnly) return <div style={{ ...cellStyle, cursor: 'default' }}>{content}</div>+return (- <div onClick={() => { if (readOnly) return; setEditValue(value ?? ''); setEditing(true) }} title={readOnly ? undefined : editTooltip}- style={{ cursor: readOnly ? 'default' : 'pointer', padding: '2px 4px', borderRadius: 4, minHeight: 22, display: 'flex', alignItems: 'center',- justifyContent: style?.textAlign === 'center' ? 'center' : 'flex-start', transition: 'background 0.15s',- color: display ? 'var(--text-primary)' : 'var(--text-faint)', fontSize: 'calc(13px * var(--fs-scale-body, 1))', ...style }}- onMouseEnter={e => { if (!readOnly) e.currentTarget.style.background = 'var(--bg-hover)' }}- onMouseLeave={e => { if (!readOnly) e.currentTarget.style.background = 'transparent' }}>- {display || placeholder || '-'}- </div>+ <button type="button"+ onClick={() => { setEditValue(value ?? ''); setEditing(true) }} title={editTooltip}+ style={{ ...cellStyle, cursor: 'pointer' }}+ onMouseEnter={e => { e.currentTarget.style.background = 'var(--bg-hover)' }}+ onMouseLeave={e => { e.currentTarget.style.background = 'transparent' }}>+ {content}+ </button>)}diff --git a/client/src/components/Budget/BudgetPanelMemberChips.test.tsx b/client/src/components/Budget/BudgetPanelMemberChips.test.tsxindex 50c913999..3e7b4a04f 100644--- a/client/src/components/Budget/BudgetPanelMemberChips.test.tsx+++ b/client/src/components/Budget/BudgetPanelMemberChips.test.tsx@@ -22,6 +22,16 @@ function setup(props: Partial<Parameters<typeof BudgetMemberChips>[0]> = {}) {return { onSetMembers, onTogglePaid, ...utils }}+/**+ * The member picker trigger. A chip that can be clicked is a real button too,+ * so it is the icon that tells the trigger apart from the chips before it.+ */+function picker(): HTMLElement {+ const trigger = screen.getAllByRole('button').find(b => b.querySelector('.lucide-pencil, .lucide-users'))+ if (!trigger) throw new Error('no picker trigger rendered')+ return trigger+}+describe('ChipWithTooltip', () => {it('FE-W4BMC-001: falls back to the uppercased initial', () => {const { container } = render(<ChipWithTooltip label="ada" avatarUrl={null} />)@@ -76,7 +86,7 @@ describe('BudgetMemberChips', () => {expect(screen.getByText('A')).toBeInTheDocument()expect(screen.getByText('B')).toBeInTheDocument()- expect(screen.getByRole('button')).toBeInTheDocument()+ expect(picker()).toBeInTheDocument()})it('FE-W4BMC-007: uses the people icon while nobody is assigned and the pencil afterwards', () => {@@ -114,9 +124,9 @@ describe('BudgetMemberChips', () => {it('FE-W4BMC-011: the picker lists every trip member and marks the assigned ones', () => {setup()- fireEvent.click(screen.getByRole('button'))+ fireEvent.click(picker())- const rows = screen.getAllByRole('button').slice(1)+ const rows = screen.getAllByRole('button').slice(2)expect(rows).toHaveLength(2)expect(rows[0]).toHaveTextContent('ada')expect(rows[0].querySelector('.lucide-check')).not.toBeNull()@@ -127,52 +137,52 @@ describe('BudgetMemberChips', () => {it('FE-W4BMC-012: picking an unassigned member adds them', () => {const { onSetMembers } = setup()- fireEvent.click(screen.getByRole('button'))+ fireEvent.click(picker())- fireEvent.click(screen.getAllByRole('button')[2])+ fireEvent.click(screen.getAllByRole('button')[3])expect(onSetMembers).toHaveBeenCalledWith([1, 2])})it('FE-W4BMC-013: picking an assigned member removes them', () => {const { onSetMembers } = setup()- fireEvent.click(screen.getByRole('button'))+ fireEvent.click(picker())- fireEvent.click(screen.getAllByRole('button')[1])+ fireEvent.click(screen.getAllByRole('button')[2])expect(onSetMembers).toHaveBeenCalledWith([])})it('FE-W4BMC-014: a mousedown outside closes the picker, inside keeps it', () => {setup()- const trigger = screen.getByRole('button')+ const trigger = picker()fireEvent.click(trigger)- fireEvent.mouseDown(screen.getAllByRole('button')[1])- expect(screen.getAllByRole('button')).toHaveLength(3)+ fireEvent.mouseDown(screen.getAllByRole('button')[2])+ expect(screen.getAllByRole('button')).toHaveLength(4)fireEvent.mouseDown(trigger)- expect(screen.getAllByRole('button')).toHaveLength(3)+ expect(screen.getAllByRole('button')).toHaveLength(4)fireEvent.mouseDown(document.body)- expect(screen.getAllByRole('button')).toHaveLength(1)+ expect(screen.getAllByRole('button')).toHaveLength(2)})it('FE-W4BMC-015: the trigger toggles the picker closed again', () => {setup()- const trigger = screen.getByRole('button')+ const trigger = picker()fireEvent.click(trigger)- expect(screen.getAllByRole('button')).toHaveLength(3)+ expect(screen.getAllByRole('button')).toHaveLength(4)fireEvent.click(trigger)- expect(screen.getAllByRole('button')).toHaveLength(1)+ expect(screen.getAllByRole('button')).toHaveLength(2)})it('FE-W4BMC-016: the non-compact variant renders larger chips', () => {setup({ compact: false })expect(screen.getByText('A')).toHaveStyle({ width: '30px' })- expect((screen.getByRole('button') as HTMLElement).style.width).toBe('28px')+ expect(picker().style.width).toBe('28px')})})diff --git a/client/src/components/Budget/BudgetPanelMemberChips.tsx b/client/src/components/Budget/BudgetPanelMemberChips.tsxindex 3cc256dec..b8bb8a244 100644--- a/client/src/components/Budget/BudgetPanelMemberChips.tsx+++ b/client/src/components/Budget/BudgetPanelMemberChips.tsx@@ -22,7 +22,7 @@ interface ChipWithTooltipProps {export function ChipWithTooltip({ label, avatarUrl, size = 20, paid, onClick }: ChipWithTooltipProps) {const [hover, setHover] = useState(false)const [pos, setPos] = useState({ top: 0, left: 0 })- const ref = useRef<HTMLDivElement>(null)+ const ref = useRef<HTMLElement | null>(null)const onEnter = () => {if (ref.current) {@@ -35,22 +35,34 @@ export function ChipWithTooltip({ label, avatarUrl, size = 20, paid, onClick }:const borderColor = paid ? '#22c55e' : 'var(--border-primary)'const bg = paid ? 'rgba(34,197,94,0.15)' : 'var(--bg-tertiary)'+ // Identical for both shells — a clickable chip is a real button so it can be+ // tabbed to and pressed, a decorative one stays a plain div.+ const chipStyle = {+ width: size, height: size, borderRadius: '50%', border: `2px solid ${borderColor}`,+ background: bg, display: 'flex', alignItems: 'center', justifyContent: 'center',+ fontSize: size * 0.4, fontWeight: 700, color: paid ? '#16a34a' : 'var(--text-muted)',+ overflow: 'hidden', flexShrink: 0, cursor: onClick ? 'pointer' : 'default',+ transition: 'border-color 0.15s, background 0.15s',+ padding: 0, fontFamily: 'inherit',+ }+ const inner = avatarUrl+ ? <img src={avatarUrl} alt="" style={{ width: '100%', height: '100%', objectFit: 'cover' }} />+ : label?.[0]?.toUpperCase()+return (<>- <div ref={ref} onMouseEnter={onEnter} onMouseLeave={() => setHover(false)}- onClick={onClick}- style={{- width: size, height: size, borderRadius: '50%', border: `2px solid ${borderColor}`,- background: bg, display: 'flex', alignItems: 'center', justifyContent: 'center',- fontSize: size * 0.4, fontWeight: 700, color: paid ? '#16a34a' : 'var(--text-muted)',- overflow: 'hidden', flexShrink: 0, cursor: onClick ? 'pointer' : 'default',- transition: 'border-color 0.15s, background 0.15s',- }}>- {avatarUrl- ? <img src={avatarUrl} style={{ width: '100%', height: '100%', objectFit: 'cover' }} />- : label?.[0]?.toUpperCase()- }- </div>+ {onClick ? (+ <button type="button" ref={el => { ref.current = el }} aria-label={label}+ onMouseEnter={onEnter} onMouseLeave={() => setHover(false)}+ onClick={onClick} style={chipStyle}>+ {inner}+ </button>+ ) : (+ <div ref={el => { ref.current = el }} onMouseEnter={onEnter} onMouseLeave={() => setHover(false)}+ style={chipStyle}>+ {inner}+ </div>+ )}{hover && createPortal(<div style={{position: 'fixed', top: pos.top, left: pos.left, transform: 'translate(-50%, -100%)',@@ -163,7 +175,7 @@ export default function BudgetMemberChips({ members = [], tripMembers = [], onSecolor: 'var(--text-muted)', overflow: 'hidden', flexShrink: 0,}}>{tm.avatar_url- ? <img src={tm.avatar_url} style={{ width: '100%', height: '100%', objectFit: 'cover' }} />+ ? <img src={tm.avatar_url} alt="" style={{ width: '100%', height: '100%', objectFit: 'cover' }} />: tm.username?.[0]?.toUpperCase()}</div>diff --git a/client/src/components/Budget/BudgetPanelRingAvatar.tsx b/client/src/components/Budget/BudgetPanelRingAvatar.tsxindex 585bfece8..3c116d049 100644--- a/client/src/components/Budget/BudgetPanelRingAvatar.tsx+++ b/client/src/components/Budget/BudgetPanelRingAvatar.tsx@@ -15,7 +15,7 @@ export default function RingAvatar({ userId, username, avatarUrl, size = 34, innoverflow: 'hidden',fontSize: size < 28 ? 10 : 12, fontWeight: 600, color: textColor,}}>- {avatarUrl ? <img src={avatarUrl} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : username?.[0]?.toUpperCase()}+ {avatarUrl ? <img src={avatarUrl} alt={username || ''} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : username?.[0]?.toUpperCase()}</div></div>)diff --git a/client/src/components/Budget/BudgetPanelSummary.tsx b/client/src/components/Budget/BudgetPanelSummary.tsxindex 6149e813a..0b9d77866 100644--- a/client/src/components/Budget/BudgetPanelSummary.tsx+++ b/client/src/components/Budget/BudgetPanelSummary.tsx@@ -83,7 +83,12 @@ export default function BudgetSummary({ theme, currency, locale, grandTotal, has{settlementOpen ? <ChevronDown size={13} /> : <ChevronRight size={13} />}{t('budget.settlement')}<span style={{ position: 'relative', display: 'inline-flex', marginLeft: 2 }}>+ {/* Decoration inside the settlement toggle: the hint hangs off+ hover, and the click only keeps the toggle from firing. A+ role of its own would give the toggle a second name and a+ nested control, so it declares itself presentational. */}<span style={{ display: 'flex', cursor: 'help' }}+ role="presentation"onMouseEnter={e => { const tip = e.currentTarget.nextElementSibling as HTMLElement; if (tip) tip.style.display = 'block' }}onMouseLeave={e => { const tip = e.currentTarget.nextElementSibling as HTMLElement; if (tip) tip.style.display = 'none' }}onClick={e => e.stopPropagation()}diff --git a/client/src/components/Budget/CostsPanel.tsx b/client/src/components/Budget/CostsPanel.tsxindex 302a1856d..a4de9d132 100644--- a/client/src/components/Budget/CostsPanel.tsx+++ b/client/src/components/Budget/CostsPanel.tsx@@ -706,7 +706,7 @@ export default function CostsPanel({ tripId, tripMembers = [] }: CostsPanelPropsreturn (<div className="exp-actions bg-surface-card border border-edge" style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: 3, flexShrink: 0, borderRadius: 999, padding: 5 }}><button type="button" title={t('common.edit')} onClick={onEdit} className="text-content-muted transition-colors" style={btn}><Pencil size={13} /></button>- <button title={deleteLabel} onClick={onDelete} className="exp-action-danger transition-colors" style={{ ...btn, color: '#dc2626' }}><Trash2 size={13} /></button>+ <button type="button" title={deleteLabel} onClick={onDelete} className="exp-action-danger transition-colors" style={{ ...btn, color: '#dc2626' }}><Trash2 size={13} /></button></div>)}diff --git a/client/src/components/Collab/CollabNotes.test.tsx b/client/src/components/Collab/CollabNotes.test.tsxindex b18854590..1ac19112d 100644--- a/client/src/components/Collab/CollabNotes.test.tsx+++ b/client/src/components/Collab/CollabNotes.test.tsx@@ -858,7 +858,7 @@ describe('CollabNotes', () => {await user.click(screen.getByTitle('Manage Categories'));await screen.findByText('Manage Categories', { selector: 'h3' });// Find the "Transport" category name span and click to edit- const categoryNameSpan = screen.getAllByText('Transport').find(el => el.tagName === 'SPAN' && el.title === 'Click to rename');+ const categoryNameSpan = screen.getAllByText('Transport').find(el => el.tagName === 'BUTTON' && el.title === 'Click to rename');if (categoryNameSpan) {await user.click(categoryNameSpan);// Now an input with value "Transport" should appear@@ -980,7 +980,7 @@ describe('CollabNotes', () => {await screen.findByText('Manage Categories', { selector: 'h3' });// Find and click the "OldCat" category name span to enter edit mode- const oldCatSpan = screen.getAllByText('OldCat').find(el => el.tagName === 'SPAN' && el.title === 'Click to rename');+ const oldCatSpan = screen.getAllByText('OldCat').find(el => el.tagName === 'BUTTON' && el.title === 'Click to rename');if (oldCatSpan) {await user.click(oldCatSpan);const editInput = screen.getByDisplayValue('OldCat');@@ -1767,10 +1767,13 @@ describe('CollabNotes details', () => {if (!img) throw new Error('image attachment not rendered yet');return img;});- fireEvent.mouseEnter(image);- expect(image.style.transform).toBe('scale(1.06)');- fireEvent.mouseLeave(image);- expect(image.style.transform).toBe('scale(1)');+ // The clickable thumbnail is a real button wrapped around the image, so the+ // hover transform lands on that button.+ const imageTile = image.closest('button') as HTMLElement;+ fireEvent.mouseEnter(imageTile);+ expect(imageTile.style.transform).toBe('scale(1.06)');+ fireEvent.mouseLeave(imageTile);+ expect(imageTile.style.transform).toBe('scale(1)');fireEvent.click(image);await waitFor(() => expect(screen.queryByText('Download itinerary.zip')).not.toBeInTheDocument());});@@ -1841,7 +1844,7 @@ describe('CollabNotes details', () => {await user.click(screen.getByTitle('Manage Categories'));await screen.findByText('Manage Categories', { selector: 'h3' });- const oldCat = screen.getAllByText('OldCat').find(el => el.tagName === 'SPAN' && el.title === 'Click to rename')!;+ const oldCat = screen.getAllByText('OldCat').find(el => el.tagName === 'BUTTON' && el.title === 'Click to rename')!;await user.click(oldCat);const editInput = screen.getByDisplayValue('OldCat');await user.clear(editInput);@@ -1894,7 +1897,7 @@ describe('CollabNotes details', () => {await user.click(screen.getByTitle('Manage Categories'));await screen.findByText('Manage Categories', { selector: 'h3' });- const oldCat = screen.getAllByText('OldCat').find(el => el.tagName === 'SPAN' && el.title === 'Click to rename')!;+ const oldCat = screen.getAllByText('OldCat').find(el => el.tagName === 'BUTTON' && el.title === 'Click to rename')!;await user.click(oldCat);const editInput = screen.getByDisplayValue('OldCat');await user.clear(editInput);diff --git a/client/src/components/Collab/CollabNotes.tsx b/client/src/components/Collab/CollabNotes.tsxindex fe484c6ff..c46477bd7 100644--- a/client/src/components/Collab/CollabNotes.tsx+++ b/client/src/components/Collab/CollabNotes.tsx@@ -403,7 +403,8 @@ function ViewNoteModal(S: NotesState) {display: 'flex', alignItems: 'center', justifyContent: 'center',zIndex: 10000, padding: 16,}}- onClick={() => setViewingNote(null)}+ role="presentation"+ onClick={e => { if (e.target === e.currentTarget) setViewingNote(null) }}><divstyle={{@@ -412,7 +413,6 @@ function ViewNoteModal(S: NotesState) {width: 'min(700px, calc(100vw - 32px))', maxHeight: '80vh',overflow: 'hidden', display: 'flex', flexDirection: 'column',}}- onClick={e => e.stopPropagation()}><div style={{padding: '16px 20px 12px', borderBottom: '1px solid var(--border-primary)',@@ -462,17 +462,18 @@ function ViewNoteModal(S: NotesState) {onMouseEnter={e => { e.currentTarget.style.transform = 'scale(1.06)'; e.currentTarget.style.boxShadow = '0 2px 8px rgba(0,0,0,0.15)' }}onMouseLeave={e => { e.currentTarget.style.transform = 'scale(1)'; e.currentTarget.style.boxShadow = 'none' }} />) : (- <div title={a.original_name} onClick={() => setPreviewFile(a)}+ <button type="button" title={a.original_name} onClick={() => setPreviewFile(a)}style={{width: 64, height: 64, borderRadius: 8, cursor: 'pointer',background: a.mime_type === 'application/pdf' ? '#ef44441a' : 'var(--bg-secondary)',display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 1,transition: 'transform 0.12s, box-shadow 0.12s',+ border: 'none', padding: 0, fontFamily: 'inherit',}}onMouseEnter={e => { e.currentTarget.style.transform = 'scale(1.06)'; e.currentTarget.style.boxShadow = '0 2px 8px rgba(0,0,0,0.15)' }}onMouseLeave={e => { e.currentTarget.style.transform = 'scale(1)'; e.currentTarget.style.boxShadow = 'none' }}><span style={{ fontSize: 'calc(10px * var(--fs-scale-caption, 1))', fontWeight: 700, color: a.mime_type === 'application/pdf' ? '#ef4444' : 'var(--text-muted)', letterSpacing: 0.3 }}>{ext}</span>- </div>+ </button>)}<span style={{ fontSize: 'calc(9px * var(--fs-scale-caption, 1))', color: 'var(--text-faint)', textAlign: 'center', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', width: '100%' }}>{a.original_name}</span></div>diff --git a/client/src/components/Collab/CollabNotesAuthedImg.tsx b/client/src/components/Collab/CollabNotesAuthedImg.tsxindex c54cd6a49..799eb9820 100644--- a/client/src/components/Collab/CollabNotesAuthedImg.tsx+++ b/client/src/components/Collab/CollabNotesAuthedImg.tsx@@ -1,10 +1,22 @@import { useState, useEffect } from 'react'import { getAuthUrl } from '../../api/authUrl'-export function AuthedImg({ src, style, onClick, onMouseEnter, onMouseLeave, alt }: { src: string; style?: React.CSSProperties; onClick?: () => void; onMouseEnter?: React.MouseEventHandler<HTMLImageElement>; onMouseLeave?: React.MouseEventHandler<HTMLImageElement>; alt?: string }) {+export function AuthedImg({ src, style, onClick, onMouseEnter, onMouseLeave, alt }: { src: string; style?: React.CSSProperties; onClick?: () => void; onMouseEnter?: React.MouseEventHandler<HTMLElement>; onMouseLeave?: React.MouseEventHandler<HTMLElement>; alt?: string }) {const [authSrc, setAuthSrc] = useState('')useEffect(() => {getAuthUrl(src, 'download').then(setAuthSrc)}, [src])- return authSrc ? <img src={authSrc} alt={alt} style={style} onClick={onClick} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} /> : null+ if (!authSrc) return null+ // A clickable thumbnail gets a real button around the image so it is+ // reachable by keyboard. The caller's style stays on the outer box, so the+ // hover transform/transition still animates the element that carries them.+ if (onClick) {+ return (+ <button type="button" onClick={onClick} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}+ style={{ ...style, padding: 0, border: 'none', background: 'none', display: 'block' }}>+ <img src={authSrc} alt={alt} style={{ ...style, width: '100%', height: '100%', display: 'block' }} />+ </button>+ )+ }+ return <img src={authSrc} alt={alt} style={style} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} />}diff --git a/client/src/components/Collab/CollabNotesCard.tsx b/client/src/components/Collab/CollabNotesCard.tsxindex 1b3baaaa2..7eaa2ff11 100644--- a/client/src/components/Collab/CollabNotesCard.tsx+++ b/client/src/components/Collab/CollabNotesCard.tsx@@ -171,17 +171,18 @@ export function NoteCard({ note, currentUser, canEdit, onUpdate, onDelete, onEdionMouseEnter={e => { e.currentTarget.style.transform = 'scale(1.08)'; e.currentTarget.style.boxShadow = '0 2px 8px rgba(0,0,0,0.15)' }}onMouseLeave={e => { e.currentTarget.style.transform = 'scale(1)'; e.currentTarget.style.boxShadow = 'none' }} />) : (- <div key={a.id} title={a.original_name} onClick={() => onPreviewFile?.(a)}+ <button type="button" key={a.id} title={a.original_name} aria-label={a.original_name} onClick={() => onPreviewFile?.(a)}style={{width: 48, height: 48, borderRadius: 8, cursor: 'pointer',background: a.mime_type === 'application/pdf' ? '#ef44441a' : 'var(--bg-secondary)',+ border: 'none', padding: 0, fontFamily: 'inherit',display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 1,transition: 'transform 0.12s, box-shadow 0.12s',}}onMouseEnter={e => { e.currentTarget.style.transform = 'scale(1.08)'; e.currentTarget.style.boxShadow = '0 2px 8px rgba(0,0,0,0.15)' }}onMouseLeave={e => { e.currentTarget.style.transform = 'scale(1)'; e.currentTarget.style.boxShadow = 'none' }}><span style={{ fontSize: 'calc(9px * var(--fs-scale-caption, 1))', fontWeight: 700, color: a.mime_type === 'application/pdf' ? '#ef4444' : 'var(--text-muted)', letterSpacing: 0.3 }}>{ext}</span>- </div>+ </button>)})}{(note.attachments?.length || 0) > (note.website ? 1 : 2) && (diff --git a/client/src/components/Collab/CollabNotesCategorySettingsModal.tsx b/client/src/components/Collab/CollabNotesCategorySettingsModal.tsxindex 2f8a856ea..8e4482e16 100644--- a/client/src/components/Collab/CollabNotesCategorySettingsModal.tsx+++ b/client/src/components/Collab/CollabNotesCategorySettingsModal.tsx@@ -69,11 +69,11 @@ export function CategorySettingsModal({ onClose, categories, categoryColors, onSposition: 'fixed', inset: 0, background: 'var(--overlay-bg, rgba(0,0,0,0.35))',backdropFilter: 'blur(6px)', WebkitBackdropFilter: 'blur(6px)',display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 9999, padding: 16, fontFamily: FONT,- }} onClick={onClose}>+ }} role="presentation" onClick={onClose}><div style={{background: 'var(--bg-card)', borderRadius: 16, width: '100%', maxWidth: 420,maxHeight: '80vh', overflow: 'auto', border: '1px solid var(--border-faint)',- }} onClick={e => e.stopPropagation()}>+ }} role="presentation" onClick={e => e.stopPropagation()}>{/* Header */}<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '14px 16px 12px', borderBottom: '1px solid var(--border-faint)' }}><h3 style={{ fontSize: 'calc(14px * var(--fs-scale-body, 1))', fontWeight: 700, color: 'var(--text-primary)', margin: 0 }}>diff --git a/client/src/components/Collab/CollabNotesEditableCatName.tsx b/client/src/components/Collab/CollabNotesEditableCatName.tsxindex 35f542608..ac396073a 100644--- a/client/src/components/Collab/CollabNotesEditableCatName.tsx+++ b/client/src/components/Collab/CollabNotesEditableCatName.tsx@@ -25,10 +25,10 @@ export function EditableCatName({ name, onRename }: EditableCatNameProps) {}return (- <span onClick={() => { setValue(name); setEditing(true) }}- style={{ flex: 1, fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontWeight: 600, color: 'var(--text-primary)', cursor: 'pointer', padding: '2px 0' }}+ <button type="button" onClick={() => { setValue(name); setEditing(true) }}+ style={{ flex: 1, fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontWeight: 600, color: 'var(--text-primary)', cursor: 'pointer', padding: '2px 0', background: 'none', border: 'none', textAlign: 'left', fontFamily: 'inherit' }}title="Click to rename">{name}- </span>+ </button>)}diff --git a/client/src/components/Collab/CollabNotesFilePreviewPortal.tsx b/client/src/components/Collab/CollabNotesFilePreviewPortal.tsxindex f1098b8ba..acf48e058 100644--- a/client/src/components/Collab/CollabNotesFilePreviewPortal.tsx+++ b/client/src/components/Collab/CollabNotesFilePreviewPortal.tsx@@ -28,10 +28,10 @@ export function FilePreviewPortal({ file, onClose }: FilePreviewPortalProps) {const openInNewTab = () => openFile(rawUrl).catch(() => {})return createPortal(- <div style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.88)', zIndex: 10000, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }} onClick={onClose}>+ <div style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.88)', zIndex: 10000, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }} role="presentation" onClick={onClose}>{isImage ? (/* Image lightbox — floating controls */- <div style={{ position: 'relative', maxWidth: '90vw', maxHeight: '90vh' }} onClick={e => e.stopPropagation()}>+ <div style={{ position: 'relative', maxWidth: '90vw', maxHeight: '90vh' }} role="presentation" onClick={e => e.stopPropagation()}>{authUrl? <img src={authUrl} alt={file.original_name} style={{ maxWidth: '90vw', maxHeight: '90vh', objectFit: 'contain', borderRadius: 8, display: 'block' }} />: <Loader2 size={32} className="animate-spin text-[rgba(255,255,255,0.5)]" />@@ -46,7 +46,7 @@ export function FilePreviewPortal({ file, onClose }: FilePreviewPortalProps) {</div>) : (/* Document viewer — card with header */- <div style={{ width: '100%', maxWidth: 950, height: '94vh', display: 'flex', flexDirection: 'column', background: 'var(--bg-card)', borderRadius: 12, overflow: 'hidden', boxShadow: '0 20px 60px rgba(0,0,0,0.3)' }} onClick={e => e.stopPropagation()}>+ <div style={{ width: '100%', maxWidth: 950, height: '94vh', display: 'flex', flexDirection: 'column', background: 'var(--bg-card)', borderRadius: 12, overflow: 'hidden', boxShadow: '0 20px 60px rgba(0,0,0,0.3)' }} role="presentation" onClick={e => e.stopPropagation()}><div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '10px 16px', borderBottom: '1px solid var(--border-primary)', flexShrink: 0 }}><span style={{ fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontWeight: 600, color: 'var(--text-primary)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 }}>{file.original_name}</span><div style={{ display: 'flex', gap: 8, flexShrink: 0 }}>diff --git a/client/src/components/Collab/CollabNotesFormModal.tsx b/client/src/components/Collab/CollabNotesFormModal.tsxindex e6b6cd2ac..289995c8e 100644--- a/client/src/components/Collab/CollabNotesFormModal.tsx+++ b/client/src/components/Collab/CollabNotesFormModal.tsx@@ -84,6 +84,7 @@ export function NoteFormModal({ onClose, onSubmit, onDeleteFile, existingCategor}}><form+ role="presentation"style={{background: 'var(--bg-card)',borderRadius: 16,diff --git a/client/src/components/Collab/CollabPolls.tsx b/client/src/components/Collab/CollabPolls.tsxindex 564ded94b..969b7a1a6 100644--- a/client/src/components/Collab/CollabPolls.tsx+++ b/client/src/components/Collab/CollabPolls.tsx@@ -88,8 +88,8 @@ function CreatePollModal({ onClose, onCreate, t }: CreatePollModalProps) {}return createPortal(- <div style={{ position: 'fixed', inset: 0, background: 'var(--overlay-bg, rgba(0,0,0,0.35))', backdropFilter: 'blur(6px)', WebkitBackdropFilter: 'blur(6px)', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 9999, padding: 16, fontFamily: FONT }} onClick={onClose}>- <form style={{ background: 'var(--bg-card)', borderRadius: 16, width: '100%', maxWidth: 400, maxHeight: '90vh', overflow: 'auto', border: '1px solid var(--border-faint)' }} onClick={e => e.stopPropagation()} onSubmit={handleSubmit}>+ <div role="presentation" style={{ position: 'fixed', inset: 0, background: 'var(--overlay-bg, rgba(0,0,0,0.35))', backdropFilter: 'blur(6px)', WebkitBackdropFilter: 'blur(6px)', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 9999, padding: 16, fontFamily: FONT }} onClick={e => { if (e.target === e.currentTarget) onClose() }}>+ <form style={{ background: 'var(--bg-card)', borderRadius: 16, width: '100%', maxWidth: 400, maxHeight: '90vh', overflow: 'auto', border: '1px solid var(--border-faint)' }} onSubmit={handleSubmit}><div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '14px 16px 12px', borderBottom: '1px solid var(--border-faint)' }}><h3 style={{ fontSize: 'calc(14px * var(--fs-scale-body, 1))', fontWeight: 700, color: 'var(--text-primary)', margin: 0 }}>{t('collab.polls.new')}</h3><button type="button" onClick={onClose} style={{ background: 'none', border: 'none', cursor: 'pointer', color: 'var(--text-faint)', padding: 2, display: 'flex' }}><X size={16} /></button>@@ -122,13 +122,13 @@ function CreatePollModal({ onClose, onCreate, t }: CreatePollModalProps) {{/* Multi choice toggle */}<label style={{ display: 'flex', alignItems: 'center', gap: 8, cursor: 'pointer' }}>- <div onClick={() => setMultiChoice(!multiChoice)} style={{- width: 36, height: 20, borderRadius: 10, padding: 2, cursor: 'pointer',+ <button type="button" role="switch" aria-checked={multiChoice} onClick={() => setMultiChoice(!multiChoice)} style={{+ width: 36, height: 20, borderRadius: 10, padding: 2, cursor: 'pointer', border: 'none',background: multiChoice ? '#007AFF' : 'var(--border-primary)', transition: 'background 0.2s',display: 'flex', alignItems: 'center',}}><div style={{ width: 16, height: 16, borderRadius: '50%', background: '#fff', transition: 'transform 0.2s', transform: multiChoice ? 'translateX(16px)' : 'translateX(0)' }} />- </div>+ </button><span style={{ fontSize: 'calc(12px * var(--fs-scale-body, 1))', color: 'var(--text-muted)', fontFamily: FONT }}>{t('collab.polls.multiChoice')}</span></label>@@ -174,7 +174,7 @@ function VoterChip({ voter, offset }: VoterChipProps) {fontSize: 'calc(7px * var(--fs-scale-caption, 1))', fontWeight: 700, color: 'var(--text-muted)', overflow: 'hidden',border: '1.5px solid var(--bg-card)', marginLeft: offset ? -5 : 0, flexShrink: 0,}}>- {voter.avatar_url ? <img src={voter.avatar_url} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : (voter.username || '?')[0].toUpperCase()}+ {voter.avatar_url ? <img src={voter.avatar_url} alt={voter.username || ''} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : (voter.username || '?')[0].toUpperCase()}</div>{hover && createPortal(<div style={{diff --git a/client/src/components/Collab/WhatsNextWidget.tsx b/client/src/components/Collab/WhatsNextWidget.tsxindex 2a3b08cfa..55745cd0e 100644--- a/client/src/components/Collab/WhatsNextWidget.tsx+++ b/client/src/components/Collab/WhatsNextWidget.tsx@@ -179,7 +179,7 @@ export default function WhatsNextWidget({ tripMembers = [] }: WhatsNextWidgetProoverflow: 'hidden', flexShrink: 0,}}>{p.avatar- ? <img src={avatarSrc(p.avatar)!} style={{ width: '100%', height: '100%', objectFit: 'cover' }} />+ ? <img src={avatarSrc(p.avatar)!} alt="" style={{ width: '100%', height: '100%', objectFit: 'cover' }} />: p.username?.[0]?.toUpperCase()}</div>diff --git a/client/src/components/Collections/AddPlaceToCollectionModal.tsx b/client/src/components/Collections/AddPlaceToCollectionModal.tsxindex 967b98fd1..fca0a8864 100644--- a/client/src/components/Collections/AddPlaceToCollectionModal.tsx+++ b/client/src/components/Collections/AddPlaceToCollectionModal.tsx@@ -135,7 +135,10 @@ export default function AddPlaceToCollectionModal({ isOpen, collectionId, collecconst coordPaste = (e: React.ClipboardEvent<HTMLInputElement>) => {const text = e.clipboardData.getData('text').trim()- const match = text.match(/^(-?\d+\.?\d*)\s*[,;\s]\s*(-?\d+\.?\d*)$/)+ // Same pairs as before, written so no two quantifiers can claim the same+ // character. In the old form `\d+\.?\d*` and `\s*[,;\s]\s*` were both ambiguous,+ // which backtracks in O(n^4): a pasted 2 kB of digits and spaces froze the tab.+ const match = text.match(/^(-?\d+(?:\.\d*)?)(?:\s*[,;]\s*|\s+)(-?\d+(?:\.\d*)?)$/)if (match) { e.preventDefault(); setLat(match[1]); setLng(match[2]) }}const coordInputClass = 'w-full px-3 py-2 rounded-lg border border-edge bg-surface-input text-content text-[14px] outline-none focus:border-accent'diff --git a/client/src/components/Collections/CollectionPlaceDetail.tsx b/client/src/components/Collections/CollectionPlaceDetail.tsxindex 46c239827..e48da127c 100644--- a/client/src/components/Collections/CollectionPlaceDetail.tsx+++ b/client/src/components/Collections/CollectionPlaceDetail.tsx@@ -152,7 +152,7 @@ export default function CollectionPlaceDetail({const resetForm = () => { setEditing(false); setName(place.name); setCategoryId(place.category_id ?? null); setDescription(place.description ?? ''); setLinks(place.links ?? []); setLabelIds(place.label_ids ?? []); setAddress(place.address ?? ''); setLat(place.lat != null ? String(place.lat) : ''); setLng(place.lng != null ? String(place.lng) : '') }const coordPaste = (e: React.ClipboardEvent<HTMLInputElement>) => {const text = e.clipboardData.getData('text').trim()- const match = text.match(/^(-?\d+\.?\d*)\s*[,;\s]\s*(-?\d+\.?\d*)$/)+ const match = text.match(/^(-?\d+(?:\.\d*)?)(?:\s*[,;]\s*|\s+)(-?\d+(?:\.\d*)?)$/)if (match) { e.preventDefault(); setLat(match[1]); setLng(match[2]) }}const assignedLabels = labels.filter(l => (place.label_ids ?? []).includes(l.id))@@ -176,7 +176,7 @@ export default function CollectionPlaceDetail({const CatIcon = getCategoryIcon(place.category?.icon)return (- <div className={`col-detail${anchorRect ? ' docked' : ''}`} style={dockStyle} onClick={e => e.stopPropagation()}>+ <div className={`col-detail${anchorRect ? ' docked' : ''}`} style={dockStyle} role="presentation" onClick={e => e.stopPropagation()}><div className="col-detail-cover" style={banner ? undefined : { backgroundImage: entityGradient(place.id) }}>{banner && <img src={banner} alt="" />}<div className="col-detail-cover-scrim" />diff --git a/client/src/components/Files/FileManagerAssignModal.tsx b/client/src/components/Files/FileManagerAssignModal.tsxindex 4263ef351..4e67cfc18 100644--- a/client/src/components/Files/FileManagerAssignModal.tsx+++ b/client/src/components/Files/FileManagerAssignModal.tsx@@ -9,9 +9,9 @@ import { transportIcon } from './FileManager.helpers'export function AssignModal(S: FileManagerState) {const { files, assignFileId, setAssignFileId, t, days, assignments, places, reservations, tripId, handleAssign, refreshFiles } = Sreturn createPortal(- <div style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.5)', zIndex: 5000, display: 'flex', alignItems: 'center', justifyContent: 'center' }}+ <div role="presentation" style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.5)', zIndex: 5000, display: 'flex', alignItems: 'center', justifyContent: 'center' }}onClick={() => setAssignFileId(null)}>- <div style={{+ <div role="presentation" style={{background: 'var(--bg-card)', borderRadius: 16, boxShadow: '0 20px 60px rgba(0,0,0,0.2)',width: 'min(600px, calc(100vw - 32px))', maxHeight: '70vh', overflow: 'hidden', display: 'flex', flexDirection: 'column',}} onClick={e => e.stopPropagation()}>diff --git a/client/src/components/Files/FileManagerAvatarChip.tsx b/client/src/components/Files/FileManagerAvatarChip.tsxindex 1f0f8582e..b50643255 100644--- a/client/src/components/Files/FileManagerAvatarChip.tsx+++ b/client/src/components/Files/FileManagerAvatarChip.tsx@@ -24,7 +24,7 @@ export function AvatarChip({ name, avatarUrl, size = 20 }: { name: string; avatacursor: 'default',}}>{avatarUrl- ? <img src={avatarUrl} style={{ width: '100%', height: '100%', objectFit: 'cover' }} />+ ? <img src={avatarUrl} alt={name} style={{ width: '100%', height: '100%', objectFit: 'cover' }} />: name?.[0]?.toUpperCase()}</div>diff --git a/client/src/components/Files/FileManagerImageLightbox.tsx b/client/src/components/Files/FileManagerImageLightbox.tsxindex d77e19bcd..cb16d6ae6 100644--- a/client/src/components/Files/FileManagerImageLightbox.tsx+++ b/client/src/components/Files/FileManagerImageLightbox.tsx@@ -68,8 +68,12 @@ export function ImageLightbox({ files, initialIndex, onClose }: ImageLightboxProreturn (<div+ // Backdrop only — Escape and the header's close button do the same job for+ // the keyboard. Closing on the backdrop's own clicks (rather than letting+ // every child stop the bubble) keeps the chrome free of click handlers.+ role="presentation"style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.92)', zIndex: 2000, display: 'flex', flexDirection: 'column', paddingBottom: 'var(--bottom-nav-h)' }}- onClick={onClose}+ onClick={e => { if (e.target === e.currentTarget) onClose() }}onTouchStart={e => setTouchStart(e.touches[0].clientX)}onTouchEnd={e => {if (touchStart === null) return@@ -80,7 +84,7 @@ export function ImageLightbox({ files, initialIndex, onClose }: ImageLightboxPro}}>{/* Header */}- <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '10px 16px', flexShrink: 0 }} onClick={e => e.stopPropagation()}>+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '10px 16px', flexShrink: 0 }}><span style={{ fontSize: 'calc(12px * var(--fs-scale-body, 1))', color: 'rgba(255,255,255,0.7)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 }}>{file.original_name}<span style={{ marginLeft: 8, color: 'rgba(255,255,255,0.4)' }}>{index + 1} / {files.length}</span>@@ -105,22 +109,22 @@ export function ImageLightbox({ files, initialIndex, onClose }: ImageLightboxPro</div>{/* Main image + nav */}- <div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', position: 'relative', minHeight: 0 }}+ <div role="presentation" style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', position: 'relative', minHeight: 0 }}onClick={e => { if (e.target === e.currentTarget) onClose() }}>{navBtn('left', goPrev, hasPrev)}{fileIsVideo ? (- <div onClick={e => e.stopPropagation()}>+ <div><VideoPlayer src={file.url} style={{ maxWidth: '85vw', maxHeight: '80vh', borderRadius: 8 }} /></div>) : (- imgSrc && <img src={imgSrc} alt={file.original_name} style={{ maxWidth: '85vw', maxHeight: '80vh', objectFit: 'contain', borderRadius: 8, display: 'block' }} onClick={e => e.stopPropagation()} />+ imgSrc && <img src={imgSrc} alt={file.original_name} style={{ maxWidth: '85vw', maxHeight: '80vh', objectFit: 'contain', borderRadius: 8, display: 'block' }} />)}{navBtn('right', goNext, hasNext)}</div>{/* Thumbnail strip */}{files.length > 1 && (- <div style={{ display: 'flex', gap: 4, justifyContent: 'center', padding: '10px 16px', flexShrink: 0, overflowX: 'auto' }} onClick={e => e.stopPropagation()}>+ <div style={{ display: 'flex', gap: 4, justifyContent: 'center', padding: '10px 16px', flexShrink: 0, overflowX: 'auto' }}>{files.map((f, i) => (<ThumbImg key={f.id} file={f} active={i === index} onClick={() => setIndex(i)} />))}diff --git a/client/src/components/Files/FileManagerMarkdownPreviewModal.tsx b/client/src/components/Files/FileManagerMarkdownPreviewModal.tsxindex b13eb1407..c5461fe0c 100644--- a/client/src/components/Files/FileManagerMarkdownPreviewModal.tsx+++ b/client/src/components/Files/FileManagerMarkdownPreviewModal.tsx@@ -34,10 +34,12 @@ export function MarkdownPreviewModal(S: FileManagerState) {return createPortal(<div+ role="presentation"style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.85)', zIndex: 10000, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}onClick={() => setPreviewFile(null)}><div+ role="presentation"style={{ width: '100%', maxWidth: 820, height: '94vh', background: 'var(--bg-card)', borderRadius: 12, overflow: 'hidden', display: 'flex', flexDirection: 'column', boxShadow: '0 20px 60px rgba(0,0,0,0.3)' }}onClick={e => e.stopPropagation()}>diff --git a/client/src/components/Files/FileManagerPdfPreviewModal.tsx b/client/src/components/Files/FileManagerPdfPreviewModal.tsxindex 55932dc27..77c208845 100644--- a/client/src/components/Files/FileManagerPdfPreviewModal.tsx+++ b/client/src/components/Files/FileManagerPdfPreviewModal.tsx@@ -8,10 +8,12 @@ export function PdfPreviewModal(S: FileManagerState) {const { previewFile, setPreviewFile, previewFileUrl, toast, t } = Sreturn createPortal(<div+ role="presentation"style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.85)', zIndex: 10000, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}onClick={() => setPreviewFile(null)}><div+ role="presentation"style={{ width: '100%', maxWidth: 950, height: '94vh', background: 'var(--bg-card)', borderRadius: 12, overflow: 'hidden', display: 'flex', flexDirection: 'column', boxShadow: '0 20px 60px rgba(0,0,0,0.3)' }}onClick={e => e.stopPropagation()}>diff --git a/client/src/components/Files/FileManagerRow.tsx b/client/src/components/Files/FileManagerRow.tsxindex 861697366..632b332fb 100644--- a/client/src/components/Files/FileManagerRow.tsx+++ b/client/src/components/Files/FileManagerRow.tsx@@ -34,10 +34,13 @@ export function FileRow(p: FileManagerState & { file: TripFile; isTrash?: booleaclassName="group">{/* Icon or thumbnail */}- <div+ <button+ type="button"+ disabled={isTrash}+ aria-label={file.original_name}onClick={() => !isTrash && openFile(file)}style={{- flexShrink: 0, width: 36, height: 36, borderRadius: 8,+ flexShrink: 0, width: 36, height: 36, borderRadius: 8, padding: 0,background: 'var(--bg-tertiary)', display: 'flex', alignItems: 'center', justifyContent: 'center',cursor: isTrash ? 'default' : 'pointer', overflow: 'hidden',}}@@ -48,13 +51,13 @@ export function FileRow(p: FileManagerState & { file: TripFile; isTrash?: booleaconst ext = (file.original_name || '').split('.').pop()?.toUpperCase() || '?'const isPdf = file.mime_type === 'application/pdf'return (- <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', width: '100%', height: '100%', background: isPdf ? '#ef44441a' : 'var(--bg-tertiary)' }}>+ <span style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', width: '100%', height: '100%', background: isPdf ? '#ef44441a' : 'var(--bg-tertiary)' }}><span style={{ fontSize: 'calc(9px * var(--fs-scale-caption, 1))', fontWeight: 700, color: isPdf ? '#ef4444' : 'var(--text-muted)', letterSpacing: 0.3 }}>{ext}</span>- </div>+ </span>)})()}- </div>+ </button>{/* Info */}<div style={{ flex: 1, minWidth: 0 }}>@@ -63,12 +66,14 @@ export function FileRow(p: FileManagerState & { file: TripFile; isTrash?: boolea<AvatarChip name={file.uploaded_by_name} avatarUrl={file.uploaded_by_avatar} size={20} />)}{!isTrash && file.starred ? <Star size={12} fill="#facc15" color="#facc15" style={{ flexShrink: 0 }} /> : null}- <span+ <button+ type="button"+ disabled={isTrash}onClick={() => !isTrash && openFile(file)}- style={{ fontWeight: 500, fontSize: 'calc(13px * var(--fs-scale-body, 1))', color: 'var(--text-primary)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', cursor: isTrash ? 'default' : 'pointer' }}+ style={{ fontWeight: 500, fontSize: 'calc(13px * var(--fs-scale-body, 1))', color: 'var(--text-primary)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', cursor: isTrash ? 'default' : 'pointer', textAlign: 'left', minWidth: 0 }}>{file.original_name}- </span>+ </button></div>{file.description && (@@ -76,7 +81,7 @@ export function FileRow(p: FileManagerState & { file: TripFile; isTrash?: boolea)}<div style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: 6, marginTop: 4 }}>- {file.file_size && <span style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', color: 'var(--text-faint)' }}>{formatSize(file.file_size)}</span>}+ {!!file.file_size && <span style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', color: 'var(--text-faint)' }}>{formatSize(file.file_size)}</span>}<span style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', color: 'var(--text-faint)' }}>{formatDateWithLocale(file.created_at, locale)}</span>{linkedPlaces.map(p => (@@ -87,7 +92,7 @@ export function FileRow(p: FileManagerState & { file: TripFile; isTrash?: boolea? <SourceBadge key={r.id} icon={transportIcon(r.type)} label={`${t('files.sourceTransport')} · ${r.title || t('files.sourceTransport')}`} />: <SourceBadge key={r.id} icon={Ticket} label={`${t('files.sourceBooking')} · ${r.title || t('files.sourceBooking')}`} />))}- {file.note_id && (+ {!!file.note_id && (<SourceBadge icon={StickyNote} label={t('files.sourceCollab') || 'Collab Notes'} />)}</div>diff --git a/client/src/components/Journey/ContributorInviteDialog.tsx b/client/src/components/Journey/ContributorInviteDialog.tsxindex 00127f431..76b2145a0 100644--- a/client/src/components/Journey/ContributorInviteDialog.tsx+++ b/client/src/components/Journey/ContributorInviteDialog.tsx@@ -72,10 +72,10 @@ export default function ContributorInviteDialog({ journeyId, existingUserIds, on<p className="text-[12px] text-zinc-400 text-center py-4">{t('journey.contributors.noUsers')}</p>)}{filtered.map(u => (- <div+ <button type="button"key={u.id}onClick={() => setSelectedUserId(u.id)}- className={`flex items-center gap-2.5 p-2.5 rounded-lg cursor-pointer transition-all ${+ className={`w-full text-left flex items-center gap-2.5 p-2.5 rounded-lg cursor-pointer transition-all ${selectedUserId === u.id? 'bg-zinc-100 dark:bg-zinc-800 border border-zinc-900 dark:border-white': 'hover:bg-zinc-50 dark:hover:bg-zinc-800 border border-transparent'@@ -93,7 +93,7 @@ export default function ContributorInviteDialog({ journeyId, existingUserIds, on<Check size={12} /></div>)}- </div>+ </button>))}</div>diff --git a/client/src/components/Journey/JourneyDetailPageDatePicker.tsx b/client/src/components/Journey/JourneyDetailPageDatePicker.tsxindex fad10d826..2eaa993c6 100644--- a/client/src/components/Journey/JourneyDetailPageDatePicker.tsx+++ b/client/src/components/Journey/JourneyDetailPageDatePicker.tsx@@ -55,7 +55,9 @@ export function DatePicker({ value, onChange, tripDates }: {{open && (<>- <div className="fixed inset-0 z-[10]" onClick={() => setOpen(false)} />+ {/* Click-away catcher — no semantics of its own; the trigger button+ above closes the popover again from the keyboard. */}+ <div role="presentation" className="fixed inset-0 z-[10]" onClick={() => setOpen(false)} /><div className="absolute top-full left-0 mt-1 z-[20] bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl shadow-lg p-3 w-[280px]">{/* Month nav */}<div className="flex items-center justify-between mb-2">diff --git a/client/src/components/Journey/JourneyDetailPageEntryCard.test.tsx b/client/src/components/Journey/JourneyDetailPageEntryCard.test.tsxindex 0094a2603..fad61473d 100644--- a/client/src/components/Journey/JourneyDetailPageEntryCard.test.tsx+++ b/client/src/components/Journey/JourneyDetailPageEntryCard.test.tsx@@ -78,7 +78,8 @@ describe('EntryCard', () => {const user = userEvent.setup()const { container, onEdit } = mountCard(buildEntry({ photos: [buildPhoto(100)] }))- await user.click(container.querySelectorAll('button')[0])+ // The photo itself is a button now, so pick the menu trigger by its own styling.+ await user.click(container.querySelector('button[class*="bg-black/40"]') as HTMLElement)await user.click(screen.getByRole('button', { name: 'Edit' }))expect(onEdit).toHaveBeenCalledTimes(1)@@ -110,7 +111,10 @@ describe('EntryCard', () => {it('FE-JRN-CARD-007: hides the menu entirely in read-only mode', () => {const { container } = mountCard(buildEntry({ photos: [buildPhoto(100)] }), true)- expect(container.querySelectorAll('button')).toHaveLength(0)+ // Only the photo remains clickable; the menu trigger is gone.+ const buttons = container.querySelectorAll('button')+ expect(buttons).toHaveLength(1)+ expect(buttons[0].querySelector('img')).toBeInTheDocument()})it('FE-JRN-CARD-008: renders mood, weather and tags in the meta row', () => {diff --git a/client/src/components/Journey/JourneyDetailPageEntryCard.tsx b/client/src/components/Journey/JourneyDetailPageEntryCard.tsxindex ec4dc0195..0bad18349 100644--- a/client/src/components/Journey/JourneyDetailPageEntryCard.tsx+++ b/client/src/components/Journey/JourneyDetailPageEntryCard.tsx@@ -78,7 +78,7 @@ export function EntryCard({ entry, readOnly, onEdit, onDelete, onPhotoClick }: {</button>{menuOpen && createPortal(<>- <div className="fixed inset-0 z-[99]" onClick={() => setMenuOpen(false)} />+ <div className="fixed inset-0 z-[99]" role="presentation" onClick={() => setMenuOpen(false)} /><div className="fixed z-[100] bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg py-1 min-w-[120px]" style={{ top: (menuBtnRef.current?.getBoundingClientRect().bottom || 0) + 4, right: window.innerWidth - (menuBtnRef.current?.getBoundingClientRect().right || 0) }}><button type="button" onClick={() => { setMenuOpen(false); onEdit() }} className="w-full text-left px-3 py-1.5 text-[12px] text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-700 flex items-center gap-2"><Pencil size={12} /> {t('common.edit')}</button><button type="button" onClick={() => { setMenuOpen(false); onDelete() }} className="w-full text-left px-3 py-1.5 text-[12px] text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center gap-2"><Trash2 size={12} /> {t('common.delete')}</button>@@ -118,7 +118,7 @@ export function EntryCard({ entry, readOnly, onEdit, onDelete, onPhotoClick }: {</button>{menuOpen && createPortal(<>- <div className="fixed inset-0 z-[99]" onClick={() => setMenuOpen(false)} />+ <div className="fixed inset-0 z-[99]" role="presentation" onClick={() => setMenuOpen(false)} /><div className="fixed z-[100] bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg py-1 min-w-[120px]" style={{ top: (menuBtnRef.current?.getBoundingClientRect().bottom || 0) + 4, right: window.innerWidth - (menuBtnRef.current?.getBoundingClientRect().right || 0) }}><button type="button" onClick={() => { setMenuOpen(false); onEdit() }} className="w-full text-left px-3 py-1.5 text-[12px] text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-700 flex items-center gap-2"><Pencil size={12} /> {t('common.edit')}</button><button type="button" onClick={() => { setMenuOpen(false); onDelete() }} className="w-full text-left px-3 py-1.5 text-[12px] text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center gap-2"><Trash2 size={12} /> {t('common.delete')}</button>@@ -185,6 +185,9 @@ export function SkeletonCard({ entry, onClick }: { entry: JourneyEntry; onClick?return (<divonClick={onClick}+ role={onClick ? 'button' : undefined}+ tabIndex={onClick ? 0 : undefined}+ onKeyDown={onClick ? e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onClick() } } : undefined}className={`rounded-[18px] px-3.5 py-3 flex items-center gap-3 transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] ${onClick ? 'hover:-translate-y-0.5 cursor-pointer' : ''}`}style={{ border: '1.5px dashed var(--vg-line2)', background: 'var(--vg-surf2)' }}>@@ -212,6 +215,9 @@ export function CheckinCard({ entry, onClick }: { entry: JourneyEntry; onClick?:return (<divonClick={onClick}+ role={onClick ? 'button' : undefined}+ tabIndex={onClick ? 0 : undefined}+ onKeyDown={onClick ? e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onClick() } } : undefined}className={`bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded-xl px-3.5 py-2.5 flex items-center gap-2.5 transition-colors duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] ${onClick ? 'hover:border-zinc-400 dark:hover:border-zinc-500 cursor-pointer' : ''}`}><div className="w-7 h-7 rounded-lg bg-indigo-50 dark:bg-indigo-900/30 text-indigo-600 dark:text-indigo-400 flex items-center justify-center flex-shrink-0">diff --git a/client/src/components/Journey/JourneyDetailPageEntryEditor.tsx b/client/src/components/Journey/JourneyDetailPageEntryEditor.tsxindex 6baaa6d65..2f6c33237 100644--- a/client/src/components/Journey/JourneyDetailPageEntryEditor.tsx+++ b/client/src/components/Journey/JourneyDetailPageEntryEditor.tsx@@ -328,8 +328,10 @@ export function EntryEditor({ entry, journeyId, tripDates, galleryPhotos, trips,<div className="mt-2 border border-zinc-200 dark:border-zinc-700 rounded-xl p-3 bg-zinc-50 dark:bg-zinc-800/50"><div className="grid grid-cols-5 sm:grid-cols-6 gap-1.5 max-h-[160px] overflow-y-auto">{availableGalleryPhotos.map(gp => (- <div+ <button+ type="button"key={gp.id}+ aria-label={t('journey.editor.fromGallery')}onClick={async () => {if (entry.id > 0) {try {@@ -341,11 +343,11 @@ export function EntryEditor({ entry, journeyId, tripDates, galleryPhotos, trips,setPhotos(prev => [...prev, gp])}}}- className="relative w-full rounded-xl overflow-hidden cursor-pointer hover:ring-2 hover:ring-zinc-900 dark:hover:ring-white hover:ring-offset-1 dark:hover:ring-offset-zinc-900 transition-all"+ className="relative block w-full rounded-xl overflow-hidden border-0 p-0 bg-transparent cursor-pointer hover:ring-2 hover:ring-zinc-900 dark:hover:ring-white hover:ring-offset-1 dark:hover:ring-offset-zinc-900 transition-all"style={{ paddingTop: '100%' }}><img src={photoUrl(gp)} alt="" className="absolute inset-0 w-full h-full object-cover" loading="lazy" onError={e => { const img = e.currentTarget; const orig = photoUrl(gp, 'original'); if (!img.src.includes('/original')) img.src = orig }} />- </div>+ </button>))}{availableGalleryPhotos.length === 0 && (<div className="col-span-full text-center py-3 text-[11px] text-zinc-400">{t('journey.editor.allPhotosAdded')}</div>@@ -658,7 +660,7 @@ export function EntryEditor({ entry, journeyId, tripDates, galleryPhotos, trips,</div>{showLocationResults && locationResults.length > 0 && (<>- <div className="fixed inset-0 z-[99]" onClick={() => setShowLocationResults(false)} />+ <div role="presentation" className="fixed inset-0 z-[99]" onClick={() => setShowLocationResults(false)} /><div className="absolute left-0 right-0 top-full mt-1 z-[100] bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl shadow-lg overflow-hidden max-h-[240px] overflow-y-auto">{locationResults.map((r, i) => (<button type="button"diff --git a/client/src/components/Journey/JourneyDetailPageExpandableStory.tsx b/client/src/components/Journey/JourneyDetailPageExpandableStory.tsxindex bb93db665..26ca3d7f9 100644--- a/client/src/components/Journey/JourneyDetailPageExpandableStory.tsx+++ b/client/src/components/Journey/JourneyDetailPageExpandableStory.tsx@@ -1,4 +1,4 @@-import { useEffect, useState, useRef } from 'react'+import { useEffect, useState, useRef, type HTMLAttributes } from 'react'import { ChevronRight } from 'lucide-react'import { useTranslation } from '../../i18n'import JournalBody from './JournalBody'@@ -23,11 +23,24 @@ export function ExpandableStory({ story }: { story: string }) {}})+ // The text block toggles the same clamp as the Show more / Show less buttons+ // below it. It only takes focus while there is something to toggle, so a+ // short story stays plain text instead of an empty stop in the tab order.+ const toggle: HTMLAttributes<HTMLDivElement> = clamped || expanded+ ? {+ role: 'button',+ tabIndex: 0,+ 'aria-expanded': expanded,+ onClick: () => setExpanded(e => !e),+ onKeyDown: e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setExpanded(v => !v) } },+ }+ : {}+return (<div><divref={ref}- onClick={() => { if (clamped || expanded) setExpanded(e => !e) }}+ {...toggle}className={`text-[13px] text-zinc-700 dark:text-zinc-300 leading-relaxed ${expanded ? '' : 'line-clamp-3 md:line-clamp-[9]'} ${clamped || expanded ? 'cursor-pointer' : ''}`}diff --git a/client/src/components/Journey/JourneyDetailPageGalleryView.tsx b/client/src/components/Journey/JourneyDetailPageGalleryView.tsxindex 18f16d075..604ad6eae 100644--- a/client/src/components/Journey/JourneyDetailPageGalleryView.tsx+++ b/client/src/components/Journey/JourneyDetailPageGalleryView.tsx@@ -152,8 +152,11 @@ export function GalleryView({ entries, gallery, journeyId, userId, trips, onPhot{shownPhotos.map((photo, i) => (<divkey={photo.id}+ role="button"+ tabIndex={0}className="relative aspect-square rounded-lg overflow-hidden cursor-pointer group"onClick={() => onPhotoClick(allPhotos, i)}+ onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onPhotoClick(allPhotos, i) } }}>{photo.media_type === 'video' && !photo.thumbnail_path ? (// Poster-less video (capture failed / unsupported codec): show adiff --git a/client/src/components/Journey/JourneyDetailPageMapView.test.tsx b/client/src/components/Journey/JourneyDetailPageMapView.test.tsxindex 85a848e37..d9b6d88dd 100644--- a/client/src/components/Journey/JourneyDetailPageMapView.test.tsx+++ b/client/src/components/Journey/JourneyDetailPageMapView.test.tsx@@ -125,7 +125,7 @@ describe('JourneyDetailPage MapView', () => {it('FE-COMP-JMAPVIEW-005: each row is numbered by its position across the whole journey', () => {renderMapView()- const berlin = screen.getByText('Museumsinsel').closest('div[class*="cursor-pointer"]')!+ const berlin = screen.getByText('Museumsinsel').closest('button[class*="cursor-pointer"]')!expect(within(berlin as HTMLElement).getByText('3')).toBeInTheDocument()})@@ -161,9 +161,9 @@ describe('JourneyDetailPage MapView', () => {renderMapView({ activeLocationId: '2' })expect(lastMapProps.current.activeMarkerId).toBe('2')- const row = screen.getByText('Sacré-Cœur').closest('div[class*="cursor-pointer"]') as HTMLElement+ const row = screen.getByText('Sacré-Cœur').closest('button[class*="cursor-pointer"]') as HTMLElementexpect(row.className).toContain('border-zinc-900')- const inactive = screen.getByText('Louvre').closest('div[class*="cursor-pointer"]') as HTMLElement+ const inactive = screen.getByText('Louvre').closest('button[class*="cursor-pointer"]') as HTMLElementexpect(inactive.className).toContain('border-zinc-200')})diff --git a/client/src/components/Journey/JourneyDetailPageMapView.tsx b/client/src/components/Journey/JourneyDetailPageMapView.tsxindex c52204747..3577b1051 100644--- a/client/src/components/Journey/JourneyDetailPageMapView.tsx+++ b/client/src/components/Journey/JourneyDetailPageMapView.tsx@@ -85,9 +85,10 @@ export function MapView({ entries, mapEntries, sortedDates, activeLocationId, fureturn (<div key={e.id}>- <div+ <button+ type="button"onClick={() => onLocationClick(String(e.id))}- className={`flex items-center gap-3 p-3 rounded-[14px] cursor-pointer transition-all ${+ className={`w-full text-left flex items-center gap-3 p-3 rounded-[14px] cursor-pointer transition-all ${isActive? 'bg-zinc-100 dark:bg-zinc-800 border border-zinc-900 dark:border-zinc-100 translate-x-0.5': 'bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 hover:border-zinc-400 dark:hover:border-zinc-500 hover:translate-x-0.5'@@ -114,7 +115,7 @@ export function MapView({ entries, mapEntries, sortedDates, activeLocationId, fu{/* Chevron */}<ChevronRight size={14} className={`flex-shrink-0 ${isActive ? 'text-zinc-900 dark:text-white' : 'text-zinc-300 dark:text-zinc-600'}`} />- </div>+ </button>{/* Connector line */}{showConnector && (diff --git a/client/src/components/Journey/JourneyDetailPagePhotoGrid.tsx b/client/src/components/Journey/JourneyDetailPagePhotoGrid.tsxindex 25d8e4cd1..d66783319 100644--- a/client/src/components/Journey/JourneyDetailPagePhotoGrid.tsx+++ b/client/src/components/Journey/JourneyDetailPagePhotoGrid.tsx@@ -2,15 +2,14 @@ import { Image } from 'lucide-react'import type { JourneyPhoto } from '../../store/journeyStore'import { photoUrl } from '../../pages/journeyDetail/JourneyDetailPage.helpers'-export function PhotoImg({ photo, className, style, onClick }: { photo: JourneyPhoto; className?: string; style?: React.CSSProperties; onClick?: () => void }) {+export function PhotoImg({ photo, className, style }: { photo: JourneyPhoto; className?: string; style?: React.CSSProperties }) {const src = photoUrl(photo, 'thumbnail')return (<imgsrc={src}- alt=""+ alt={photo.caption || ''}className={className}style={style}- onClick={onClick}loading="lazy"/>)@@ -22,9 +21,9 @@ export function PhotoGrid({ photos, onClick }: { photos: JourneyPhoto[]; onClickif (count === 1) {return (- <div className="overflow-hidden cursor-pointer" onClick={() => onClick(0)}>+ <button type="button" className="block w-full overflow-hidden cursor-pointer" onClick={() => onClick(0)}><PhotoImg photo={photos[0]} className="w-full h-72 object-cover" />- </div>+ </button>)}@@ -32,7 +31,9 @@ export function PhotoGrid({ photos, onClick }: { photos: JourneyPhoto[]; onClickreturn (<div className="grid grid-cols-2 gap-0.5 overflow-hidden">{photos.slice(0, 2).map((p, i) => (- <PhotoImg key={p.id} photo={p} className="w-full h-52 object-cover cursor-pointer" onClick={() => onClick(i)} />+ <button key={p.id} type="button" className="block w-full h-52 overflow-hidden cursor-pointer" onClick={() => onClick(i)}>+ <PhotoImg photo={p} className="w-full h-full object-cover" />+ </button>))}</div>)@@ -40,14 +41,14 @@ export function PhotoGrid({ photos, onClick }: { photos: JourneyPhoto[]; onClickreturn (<div className="overflow-hidden flex" style={{ height: 300, gap: 2 }}>- <div className="flex-1 min-w-0 cursor-pointer" onClick={() => onClick(0)}>+ <button type="button" className="flex-1 min-w-0 cursor-pointer" onClick={() => onClick(0)}><PhotoImg photo={photos[0]} className="w-full h-full object-cover" />- </div>+ </button><div className="flex-1 min-w-0 flex flex-col" style={{ gap: 2 }}>- <div className="flex-1 min-h-0 cursor-pointer" onClick={() => onClick(1)}>+ <button type="button" className="flex-1 min-h-0 cursor-pointer" onClick={() => onClick(1)}><PhotoImg photo={photos[1]} className="w-full h-full object-cover" />- </div>- <div className="flex-1 min-h-0 relative cursor-pointer" onClick={() => onClick(2)}>+ </button>+ <button type="button" className="flex-1 min-h-0 relative cursor-pointer" onClick={() => onClick(2)}><PhotoImg photo={photos[2]} className="w-full h-full object-cover" />{count > 3 && (<div className="absolute bottom-2 right-2 bg-black/60 backdrop-blur text-white rounded-full px-2 py-0.5 text-[10px] font-semibold flex items-center gap-1">@@ -55,7 +56,7 @@ export function PhotoGrid({ photos, onClick }: { photos: JourneyPhoto[]; onClick+{count - 3}</div>)}- </div>+ </button></div></div>)diff --git a/client/src/components/Journey/JourneyDetailPageProviderPicker.tsx b/client/src/components/Journey/JourneyDetailPageProviderPicker.tsxindex 4737c5776..c144541a5 100644--- a/client/src/components/Journey/JourneyDetailPageProviderPicker.tsx+++ b/client/src/components/Journey/JourneyDetailPageProviderPicker.tsx@@ -144,6 +144,7 @@ export function ProviderPicker({ provider, userId, entries, trips, existingAssetclassName={embedded? 'w-full h-full min-h-0 flex flex-col overflow-hidden': 'fixed inset-0 z-[9999] flex items-end md:items-center justify-center md:p-5 overscroll-none bg-[rgba(9,9,11,0.75)]'}+ role="presentation"onClick={embedded ? undefined : onClose}onTouchMove={e => { if (!embedded && e.target === e.currentTarget) e.preventDefault() }}>@@ -152,6 +153,7 @@ export function ProviderPicker({ provider, userId, entries, trips, existingAsset? 'bg-white dark:bg-zinc-900 w-full h-full flex flex-col overflow-hidden': 'bg-white dark:bg-zinc-900 rounded-t-2xl md:rounded-2xl shadow-[0_20px_40px_rgba(0,0,0,0.2)] max-w-[720px] md:max-w-[960px] w-full max-h-[calc(100dvh-var(--bottom-nav-h)-20px)] md:max-h-[85vh] flex flex-col overflow-hidden'}style={{ paddingBottom: 'env(safe-area-inset-bottom, 0px)' }}+ role="presentation"onClick={e => e.stopPropagation()}>@@ -274,7 +276,7 @@ export function ProviderPicker({ provider, userId, entries, trips, existingAsset</button>{addToOpen && (<>- <div className="fixed inset-0 z-[9]" onClick={() => setAddToOpen(false)} />+ <div className="fixed inset-0 z-[9]" role="presentation" onClick={() => setAddToOpen(false)} /><div className="absolute left-12 top-full mt-1 z-10 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl shadow-lg py-1.5 min-w-[200px] max-h-[240px] overflow-y-auto"><button type="button"onClick={() => { setTargetEntryId(null); setAddToOpen(false) }}@@ -365,10 +367,14 @@ export function ProviderPicker({ provider, userId, entries, trips, existingAssetconst isSelected = selected.has(asset.id)const alreadyAdded = existingAssetIds.has(asset.id)return (- <div+ <button+ type="button"key={asset.id}+ disabled={alreadyAdded}+ aria-pressed={isSelected}+ aria-label={asset.city || group.label}onClick={() => !alreadyAdded && toggleAsset(asset.id)}- className={`relative aspect-square rounded-lg overflow-hidden ${+ className={`relative block w-full aspect-square rounded-lg overflow-hidden ${alreadyAdded? 'opacity-40 cursor-not-allowed': isSelected@@ -402,7 +408,7 @@ export function ProviderPicker({ provider, userId, entries, trips, existingAsset<p className="text-[8px] text-white truncate">{asset.city}</p></div>)}- </div>+ </button>)})}</div>diff --git a/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsx b/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsxindex a461916fa..db206aac3 100644--- a/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsx+++ b/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsx@@ -87,8 +87,8 @@ export function JourneySettingsDialog({ journey, onClose, onSaved, onOpenInvite,}return (- <div className="fixed inset-0 z-[200] flex items-end md:items-center justify-center md:p-5 overscroll-none bg-[rgba(9,9,11,0.75)]" onClick={handleClose} onTouchMove={e => { if (e.target === e.currentTarget) e.preventDefault() }}>- <div className="bg-white dark:bg-zinc-900 rounded-t-2xl md:rounded-[24px] shadow-[0_20px_40px_rgba(0,0,0,0.2)] max-w-[980px] w-full max-h-[85vh] md:max-h-[90vh] flex flex-col overflow-hidden" style={{ paddingBottom: 'env(safe-area-inset-bottom, 0px)' }} onClick={e => e.stopPropagation()}>+ <div role="presentation" className="fixed inset-0 z-[200] flex items-end md:items-center justify-center md:p-5 overscroll-none bg-[rgba(9,9,11,0.75)]" onClick={handleClose} onTouchMove={e => { if (e.target === e.currentTarget) e.preventDefault() }}>+ <div role="presentation" className="bg-white dark:bg-zinc-900 rounded-t-2xl md:rounded-[24px] shadow-[0_20px_40px_rgba(0,0,0,0.2)] max-w-[980px] w-full max-h-[85vh] md:max-h-[90vh] flex flex-col overflow-hidden" style={{ paddingBottom: 'env(safe-area-inset-bottom, 0px)' }} onClick={e => e.stopPropagation()}><div className="flex items-center justify-between px-6 py-4 border-b border-zinc-200 dark:border-zinc-700"><h2 className="text-[16px] font-bold text-zinc-900 dark:text-white">{t('journey.settings.title')}</h2>@@ -278,7 +278,7 @@ export function JourneySettingsDialog({ journey, onClose, onSaved, onOpenInvite,{/* Add Trip — sits inside the backdrop, so its clicks have to be keptfrom bubbling into the close/discard handler underneath */}{showAddTrip && (- <div onClick={e => e.stopPropagation()}>+ <div role="presentation" onClick={e => e.stopPropagation()}><AddTripDialogjourneyId={journey.id}existingTripIds={journey.trips.map((t: any) => t.trip_id)}diff --git a/client/src/components/Journey/JourneyShareSection.tsx b/client/src/components/Journey/JourneyShareSection.tsxindex b574be460..7d0a3e0a3 100644--- a/client/src/components/Journey/JourneyShareSection.tsx+++ b/client/src/components/Journey/JourneyShareSection.tsx@@ -36,11 +36,12 @@ export default function JourneyShareSection({ journeyId }: { journeyId: number }const togglePerm = async (key: 'share_timeline' | 'share_gallery' | 'share_map') => {if (!link) return+ const previous = linkconst updated = { ...link, [key]: !link[key] }setLink(updated)try {await journeyApi.createShareLink(journeyId, { share_timeline: updated.share_timeline, share_gallery: updated.share_gallery, share_map: updated.share_map })- } catch { setLink(link); toast.error(t('journey.share.updateFailed')) }+ } catch { setLink(previous); toast.error(t('journey.share.updateFailed')) }}const deleteLink = async () => {diff --git a/client/src/components/Journey/MobileEntryView.tsx b/client/src/components/Journey/MobileEntryView.tsxindex 5daf4d664..fc92b07f7 100644--- a/client/src/components/Journey/MobileEntryView.tsx+++ b/client/src/components/Journey/MobileEntryView.tsx@@ -91,12 +91,18 @@ export default function MobileEntryView({ entry, readOnly, publicPhotoUrl, onClo{/* Hero photo(s) */}{photos.length > 0 && (<div className="relative">- <img- src={photoUrl(photos[0], 'original', publicPhotoUrl)}- alt=""- className="w-full max-h-[50vh] object-cover cursor-pointer"+ <button+ type="button"+ aria-label={photos[0].caption || t('journey.photos')}+ className="block w-full bg-transparent border-0 p-0 cursor-pointer"onClick={() => onPhotoClick(photos, 0)}- />+ >+ <img+ src={photoUrl(photos[0], 'original', publicPhotoUrl)}+ alt=""+ className="w-full max-h-[50vh] object-cover"+ />+ </button>{photos.length > 1 && (<div className="absolute bottom-3 right-3 flex items-center gap-1 bg-black/60 backdrop-blur-sm text-white rounded-full px-2.5 py-1 text-[11px] font-medium"><Camera size={12} />@@ -107,13 +113,19 @@ export default function MobileEntryView({ entry, readOnly, publicPhotoUrl, onClo{photos.length > 1 && (<div className="flex gap-1 px-4 py-2 overflow-x-auto bg-zinc-50 dark:bg-zinc-900">{photos.map((p, i) => (- <img+ <buttonkey={p.id || i}- src={photoUrl(p, 'thumbnail', publicPhotoUrl)}- alt=""- className="w-16 h-16 rounded-lg object-cover flex-shrink-0 cursor-pointer hover:ring-2 ring-zinc-900/30 dark:ring-white/30 transition-all"+ type="button"+ aria-label={p.caption || t('journey.photos')}+ className="flex-shrink-0 bg-transparent border-0 p-0 cursor-pointer"onClick={() => onPhotoClick(photos, i)}- />+ >+ <img+ src={photoUrl(p, 'thumbnail', publicPhotoUrl)}+ alt=""+ className="w-16 h-16 rounded-lg object-cover hover:ring-2 ring-zinc-900/30 dark:ring-white/30 transition-all"+ />+ </button>))}</div>)}diff --git a/client/src/components/Journey/VideoPlayer.tsx b/client/src/components/Journey/VideoPlayer.tsxindex 98a643161..e66765b99 100644--- a/client/src/components/Journey/VideoPlayer.tsx+++ b/client/src/components/Journey/VideoPlayer.tsx@@ -45,7 +45,10 @@ export default function VideoPlayer({...style,}}>- <video ref={videoRef} src={src} poster={poster} playsInline controls preload="metadata" />+ <video ref={videoRef} src={src} poster={poster} playsInline controls preload="metadata">+ {/* Gallery uploads carry no caption file; the empty track keeps the element valid. */}+ <track kind="captions" />+ </video></div>)}diff --git a/client/src/components/Journey/stripMarkdown.ts b/client/src/components/Journey/stripMarkdown.tsindex f600a9b21..1667f005a 100644--- a/client/src/components/Journey/stripMarkdown.ts+++ b/client/src/components/Journey/stripMarkdown.ts@@ -5,7 +5,9 @@export function stripMarkdown(md: string): string {return md.replace(/^#{1,6}\s+/gm, '') // headings- .replace(/!\[.*?\]\(.*?\)/g, '') // images+ // the alt text is a run that cannot contain "](", so it ends on the first one+ // instead of being retried against every later "](". Same matches, no backtracking+ .replace(/!\[(?:(?!\]\().)*\]\(.*?\)/g, '') // images.replace(/\[([^\]]*)\]\(.*?\)/g, '$1') // links → text.replace(/(`{3}[\s\S]*?`{3})/g, '') // code blocks.replace(/`([^`]+)`/g, '$1') // inline codediff --git a/client/src/components/Layout/DemoBanner.tsx b/client/src/components/Layout/DemoBanner.tsxindex a8179fefc..0bda3e682 100644--- a/client/src/components/Layout/DemoBanner.tsx+++ b/client/src/components/Layout/DemoBanner.tsx@@ -304,9 +304,20 @@ export default function DemoBanner(): React.ReactElement | null {overflow: 'auto',fontFamily: 'var(--font-system)',}}+ role="button"+ tabIndex={0}+ aria-label={t.close}onClick={() => setDismissed(true)}+ onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {+ if (e.target !== e.currentTarget) return;+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ setDismissed(true);+ }+ }}><div+ role="presentation"style={{background: 'white',borderRadius: 20,diff --git a/client/src/components/Layout/InAppNotificationBell.tsx b/client/src/components/Layout/InAppNotificationBell.tsxindex 719aca9d2..18754f28e 100644--- a/client/src/components/Layout/InAppNotificationBell.tsx+++ b/client/src/components/Layout/InAppNotificationBell.tsx@@ -69,7 +69,8 @@ export default function InAppNotificationBell(): React.ReactElement {{open && createPortal(<>- <div style={{ position: 'fixed', inset: 0, zIndex: 9998 }} onClick={() => setOpen(false)} />+ {/* Click-away catcher only — the bell button itself closes the panel again from the keyboard. */}+ <div role="presentation" style={{ position: 'fixed', inset: 0, zIndex: 9998 }} onClick={() => setOpen(false)} /><divclassName="rounded-xl shadow-xl border overflow-hidden bg-surface-card border-edge"style={{diff --git a/client/src/components/Layout/MobileTopBar.tsx b/client/src/components/Layout/MobileTopBar.tsxindex 88272948f..c87825756 100644--- a/client/src/components/Layout/MobileTopBar.tsx+++ b/client/src/components/Layout/MobileTopBar.tsx@@ -59,11 +59,12 @@ function ProfileSheet({ onClose }: { onClose: () => void }) {const handleLogout = () => { onClose(); logout(); navigate('/login') }return (- <div className="fixed inset-0 z-[300] md:hidden" onClick={onClose}>+ <div className="fixed inset-0 z-[300] md:hidden" role="presentation" onClick={onClose}><div className="absolute inset-0 bg-black/50 backdrop-blur-sm" /><divclassName="absolute bottom-0 left-0 right-0 bg-white dark:bg-zinc-900 rounded-t-2xl overflow-hidden"style={{ animation: 'slideUp 0.25s ease-out', paddingBottom: 'env(safe-area-inset-bottom, 0px)' }}+ role="presentation"onClick={e => e.stopPropagation()}><div className="flex justify-center pt-3 pb-2">diff --git a/client/src/components/Layout/Navbar.tsx b/client/src/components/Layout/Navbar.tsxindex 48c6ed51d..cba250429 100644--- a/client/src/components/Layout/Navbar.tsx+++ b/client/src/components/Layout/Navbar.tsx@@ -272,7 +272,7 @@ export default function Navbar({ tripTitle, tripId, onBack, showBack, onShare }:{userMenuOpen && createPortal(<>- <div style={{ position: 'fixed', inset: 0, zIndex: 9998 }} onClick={() => setUserMenuOpen(false)} />+ <div style={{ position: 'fixed', inset: 0, zIndex: 9998 }} role="presentation" onClick={() => setUserMenuOpen(false)} /><div className="trek-menu-enter w-52 rounded-xl shadow-xl border overflow-hidden bg-surface-card border-edge" style={{ position: 'fixed', top: 'var(--nav-h)', right: 8, zIndex: 9999 }}><div className="px-4 py-3 border-b border-edge-secondary"><p className="text-sm font-medium text-content">{user.username}</p>diff --git a/client/src/components/Layout/PageSidebar.tsx b/client/src/components/Layout/PageSidebar.tsxindex ad2841855..a81203678 100644--- a/client/src/components/Layout/PageSidebar.tsx+++ b/client/src/components/Layout/PageSidebar.tsx@@ -94,6 +94,7 @@ export default function PageSidebar({<><divclassName="lg:hidden fixed inset-0 z-40 bg-[rgba(0,0,0,0.35)]"+ role="presentation"onClick={() => setMobileOpen(false)}/><asidediff --git a/client/src/components/Map/transitGeometry.ts b/client/src/components/Map/transitGeometry.tsindex b12d76d42..0852c9006 100644--- a/client/src/components/Map/transitGeometry.ts+++ b/client/src/components/Map/transitGeometry.ts@@ -27,7 +27,7 @@ export function decodePolyline(encoded: string, precision = 6): [number, number]let byte = 0x20while (byte >= 0x20) {if (index >= encoded.length) return coords- byte = encoded.charCodeAt(index++) - 63+ byte = encoded.codePointAt(index++) - 63result |= (byte & 0x1f) << shiftshift += 5}diff --git a/client/src/components/Notifications/InAppNotificationItem.tsx b/client/src/components/Notifications/InAppNotificationItem.tsxindex e95a0f1f2..6a501baec 100644--- a/client/src/components/Notifications/InAppNotificationItem.tsx+++ b/client/src/components/Notifications/InAppNotificationItem.tsx@@ -130,9 +130,7 @@ export default function InAppNotificationItem({ notification, onClose }: Notificstyle={{background: notification.response === 'positive'? 'var(--text-primary)'- : notification.response === 'negative'- ? (dark ? '#27272a' : '#f1f5f9')- : (dark ? '#27272a' : '#f1f5f9'),+ : (dark ? '#27272a' : '#f1f5f9'),color: notification.response === 'positive'? '#fff': notification.response === 'negative'@@ -152,9 +150,7 @@ export default function InAppNotificationItem({ notification, onClose }: Notificstyle={{background: notification.response === 'negative'? '#ef4444'- : notification.response === 'positive'- ? (dark ? '#27272a' : '#f1f5f9')- : (dark ? '#27272a' : '#f1f5f9'),+ : (dark ? '#27272a' : '#f1f5f9'),color: notification.response === 'negative'? '#fff': notification.response === 'positive'diff --git a/client/src/components/OAuth/ScopeGroupPicker.tsx b/client/src/components/OAuth/ScopeGroupPicker.tsxindex cd3183dad..c9c20d259 100644--- a/client/src/components/OAuth/ScopeGroupPicker.tsx+++ b/client/src/components/OAuth/ScopeGroupPicker.tsx@@ -77,9 +77,9 @@ export default function ScopeGroupPicker({ selected, onChange }: Props): React.R)}className="mt-0.5 rounded flex-shrink-0"/>- <div>- <p className="text-xs font-medium text-content">{label}</p>- <p className="text-xs" style={{ color: 'var(--text-tertiary)' }}>{description}</p>+ <div className="text-xs font-medium text-content">+ {label}+ <p className="text-xs font-normal" style={{ color: 'var(--text-tertiary)' }}>{description}</p></div></label>))}diff --git a/client/src/components/PDF/TripPDF.tsx b/client/src/components/PDF/TripPDF.tsxindex 7574a8732..8a7c3c789 100644--- a/client/src/components/PDF/TripPDF.tsx+++ b/client/src/components/PDF/TripPDF.tsx@@ -85,7 +85,7 @@ function escHtml(str) {// escHtml alone cannot stop a cover_image from closing the url() and appending its own// declaration. Percent-encoding is transparent to the fetch.function cssUrl(url) {- return String(url).replace(/["'()\\\s]/g, c => '%' + c.charCodeAt(0).toString(16).padStart(2, '0'))+ return String(url).replace(/["'()\\\s]/g, c => '%' + c.codePointAt(0).toString(16).padStart(2, '0'))}function absUrl(url) {diff --git a/client/src/components/Packing/PackingListPanel.test.tsx b/client/src/components/Packing/PackingListPanel.test.tsxindex 63be3f0b3..46b465052 100644--- a/client/src/components/Packing/PackingListPanel.test.tsx+++ b/client/src/components/Packing/PackingListPanel.test.tsx@@ -1,6 +1,6 @@// FE-COMP-PACKING-001 to FE-COMP-PACKING-020import { vi } from 'vitest';-import { render, screen, waitFor, fireEvent } from '../../../tests/helpers/render';+import { render, screen, waitFor, fireEvent, within } from '../../../tests/helpers/render';import userEvent from '@testing-library/user-event';import { http, HttpResponse } from 'msw';import { server } from '../../../tests/helpers/msw/server';@@ -899,9 +899,10 @@ describe('PackingListPanel', () => {const packageBtn = container.querySelector('svg.lucide-package')?.closest('button');fireEvent.click(packageBtn!);- // Picker is open - find "Trolley" button inside the dropdown- // The dropdown renders as an absolute positioned div inside the item row- const trolleyBtn = await screen.findByRole('button', { name: /Trolley/ });+ // Picker is open - find "Trolley" button inside the dropdown. The bag+ // sidebar carries the same name on its own button, so scope the query to+ // the picker (the dropdown is a sibling of the package button).+ const trolleyBtn = await within(packageBtn!.parentElement!).findByRole('button', { name: /Trolley/ });fireEvent.click(trolleyBtn);await waitFor(() => expect(putBody).toMatchObject({ bag_id: 7 }));diff --git a/client/src/components/Packing/PackingListPanelBagCard.tsx b/client/src/components/Packing/PackingListPanelBagCard.tsxindex 1b275d1f4..a8414a1dd 100644--- a/client/src/components/Packing/PackingListPanelBagCard.tsx+++ b/client/src/components/Packing/PackingListPanelBagCard.tsx@@ -59,7 +59,8 @@ export function BagCard({ bag, bagItems, totalWeight, pct, tripId, tripMembers,onBlur={saveName} onKeyDown={e => { if (e.key === 'Enter') saveName(); if (e.key === 'Escape') { setEditingName(false); setNameVal(bag.name) } }}style={{ flex: 1, fontSize: sz.name, fontWeight: 600, padding: '1px 4px', borderRadius: 4, border: '1px solid var(--border-primary)', outline: 'none', fontFamily: 'inherit', color: 'var(--text-primary)', background: 'transparent' }} />) : (- <span onClick={() => canEdit && setEditingName(true)} style={{ flex: 1, fontSize: sz.name, fontWeight: 600, color: compact ? 'var(--text-secondary)' : 'var(--text-primary)', cursor: canEdit ? 'text' : 'default' }}>{bag.name}</span>+ <button type="button" disabled={!canEdit} onClick={() => setEditingName(true)}+ style={{ flex: 1, fontSize: sz.name, fontWeight: 600, color: compact ? 'var(--text-secondary)' : 'var(--text-primary)', cursor: canEdit ? 'text' : 'default', background: 'none', border: 'none', padding: 0, textAlign: 'left', fontFamily: 'inherit' }}>{bag.name}</button>)}<span style={{ fontSize: sz.weight, color: 'var(--text-faint)', fontWeight: 500, display: 'inline-flex', alignItems: 'center', gap: 3 }}>{totalWeight >= 1000 ? `${(totalWeight / 1000).toFixed(1)} kg` : `${totalWeight} g`}@@ -74,10 +75,10 @@ export function BagCard({ bag, bagItems, totalWeight, pct, tripId, tripMembers,<span>kg</span></>) : bag.weight_limit_grams ? (- <span onClick={() => canEdit && setEditingLimit(true)} title={t('packing.bagLimit')}- style={{ cursor: canEdit ? 'text' : 'default' }}>+ <button type="button" disabled={!canEdit} onClick={() => setEditingLimit(true)} title={t('packing.bagLimit')}+ style={{ cursor: canEdit ? 'text' : 'default', background: 'none', border: 'none', padding: 0, fontFamily: 'inherit', fontSize: 'inherit' }}>/ {(bag.weight_limit_grams / 1000).toFixed(1)} kg- </span>+ </button>) : canEdit ? (<button type="button" onClick={() => setEditingLimit(true)} title={t('packing.bagLimit')}style={{ background: 'none', border: 'none', padding: 0, cursor: 'pointer', color: 'var(--text-faint)', fontSize: sz.count, fontFamily: 'inherit', textDecoration: 'underline dotted' }}>@@ -89,17 +90,22 @@ export function BagCard({ bag, bagItems, totalWeight, pct, tripId, tripMembers,</div>{/* Members */}<div style={{ display: 'flex', alignItems: 'center', gap: 4, marginBottom: 4, flexWrap: 'wrap', position: 'relative' }}>- {(bag.members || []).map(m => (- <span key={m.user_id} title={m.username} onClick={() => canEdit && toggleMember(m.user_id)} style={{ cursor: canEdit ? 'pointer' : 'default', display: 'inline-flex' }}>- {m.avatar ? (- <img src={m.avatar} alt={m.username} style={{ width: sz.avatar, height: sz.avatar, borderRadius: '50%', objectFit: 'cover', border: `1.5px solid ${bag.color}`, boxSizing: 'border-box' }} />- ) : (- <span style={{ width: sz.avatar, height: sz.avatar, borderRadius: '50%', background: bag.color + '25', color: bag.color, fontSize: sz.avatar * 0.45, fontWeight: 700, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', border: `1.5px solid ${bag.color}`, boxSizing: 'border-box' }}>- {m.username[0].toUpperCase()}- </span>- )}- </span>- ))}+ {(bag.members || []).map(m => {+ const face = m.avatar ? (+ <img src={m.avatar} alt={m.username} style={{ width: sz.avatar, height: sz.avatar, borderRadius: '50%', objectFit: 'cover', border: `1.5px solid ${bag.color}`, boxSizing: 'border-box' }} />+ ) : (+ <span style={{ width: sz.avatar, height: sz.avatar, borderRadius: '50%', background: bag.color + '25', color: bag.color, fontSize: sz.avatar * 0.45, fontWeight: 700, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', border: `1.5px solid ${bag.color}`, boxSizing: 'border-box' }}>+ {m.username[0].toUpperCase()}+ </span>+ )+ if (!canEdit) return <span key={m.user_id} title={m.username} style={{ display: 'inline-flex' }}>{face}</span>+ return (+ <button type="button" key={m.user_id} title={m.username} aria-label={m.username} onClick={() => toggleMember(m.user_id)}+ style={{ cursor: 'pointer', display: 'inline-flex', background: 'none', border: 'none', padding: 0 }}>+ {face}+ </button>+ )+ })}{canEdit && (<button type="button" onClick={() => setShowUserPicker(v => !v)} style={{ width: sz.avatar, height: sz.avatar, borderRadius: '50%', border: '1.5px dashed var(--border-primary)', background: 'none', color: 'var(--text-faint)', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 0, boxSizing: 'border-box' }}><Plus size={sz.avatar * 0.5} />diff --git a/client/src/components/Packing/PackingListPanelBagModal.tsx b/client/src/components/Packing/PackingListPanelBagModal.tsxindex 268b5496c..8f43d2dbc 100644--- a/client/src/components/Packing/PackingListPanelBagModal.tsx+++ b/client/src/components/Packing/PackingListPanelBagModal.tsx@@ -15,8 +15,13 @@ export function BagModal(S: PackingState) {const heaviestBagWeight = Math.max(...bags.map(b => myItems.filter(i => i.bag_id === b.id).reduce((s, i) => s + itemWeight(i), 0)), 1)return (<div style={{ position: 'fixed', inset: 0, zIndex: 100, background: 'rgba(0,0,0,0.3)', display: 'flex', alignItems: 'flex-start', justifyContent: 'center', padding: 20, paddingTop: 140, paddingBottom: 'calc(20px + var(--bottom-nav-h))', overflowY: 'auto' }}- onClick={() => setShowBagModal(false)}>- <div style={{ background: 'var(--bg-card)', borderRadius: 16, width: '100%', maxWidth: 360, maxHeight: 'calc(100vh - 80px)', overflow: 'auto', padding: 20, boxShadow: '0 16px 48px rgba(0,0,0,0.15)', flexShrink: 0 }}+ role="button" tabIndex={0} aria-label={t('common.close')}+ onClick={() => setShowBagModal(false)}+ onKeyDown={e => {+ if (e.target !== e.currentTarget) return+ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setShowBagModal(false) }+ }}>+ <div role="presentation" style={{ background: 'var(--bg-card)', borderRadius: 16, width: '100%', maxWidth: 360, maxHeight: 'calc(100vh - 80px)', overflow: 'auto', padding: 20, boxShadow: '0 16px 48px rgba(0,0,0,0.15)', flexShrink: 0 }}onClick={e => e.stopPropagation()}><div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 16 }}><h3 style={{ margin: 0, fontSize: 'calc(16px * var(--fs-scale-subtitle, 1))', fontWeight: 700, color: 'var(--text-primary)' }}>{t('packing.bags')}</h3>diff --git a/client/src/components/Packing/PackingListPanelCategoryGroup.test.tsx b/client/src/components/Packing/PackingListPanelCategoryGroup.test.tsxindex dfe17fc3b..299d40849 100644--- a/client/src/components/Packing/PackingListPanelCategoryGroup.test.tsx+++ b/client/src/components/Packing/PackingListPanelCategoryGroup.test.tsx@@ -377,7 +377,10 @@ describe('KategorieGruppe — assignees', () => {})fireEvent.click(container.querySelector('svg.lucide-user-plus')!.closest('button')!)- fireEvent.click(within(screen.getByRole('button', { name: /alice/ })).getByText('alice').closest('button')!)+ // Scoped to the dropdown: an assigned member also has a chip button carrying+ // their name, so an unscoped role query matches two elements.+ const dropdown = within(container.querySelector('svg.lucide-user-plus')!.closest('div')!)+ fireEvent.click(dropdown.getByRole('button', { name: /alice/ }))expect(onSetAssignees).toHaveBeenCalledWith('Gear', [1])})@@ -388,8 +391,9 @@ describe('KategorieGruppe — assignees', () => {assignees: [{ user_id: 1, username: 'owner' }],})fireEvent.click(container.querySelector('svg.lucide-user-plus')!.closest('button')!)- const assigned = screen.getByRole('button', { name: /owner/ })- const free = screen.getByRole('button', { name: /alice/ })+ const dropdown = within(container.querySelector('svg.lucide-user-plus')!.closest('div')!)+ const assigned = dropdown.getByRole('button', { name: /owner/ })+ const free = dropdown.getByRole('button', { name: /alice/ })fireEvent.mouseEnter(free)expect(free.style.background).toBe('var(--bg-tertiary)')diff --git a/client/src/components/Packing/PackingListPanelCategoryGroup.tsx b/client/src/components/Packing/PackingListPanelCategoryGroup.tsxindex b31beb2d0..45570ad78 100644--- a/client/src/components/Packing/PackingListPanelCategoryGroup.tsx+++ b/client/src/components/Packing/PackingListPanelCategoryGroup.tsx@@ -137,32 +137,43 @@ export function KategorieGruppe({ kategorie, items, tripId, allCategories, onRen{/* Assignee chips */}<div style={{ display: 'flex', alignItems: 'center', gap: 3, flex: 1, minWidth: 0, marginLeft: 4 }}>- {assignees.map(a => (- <div key={a.user_id} style={{ position: 'relative' }}- onClick={e => { e.stopPropagation(); if (canEdit) onSetAssignees(kategorie, assignees.filter(x => x.user_id !== a.user_id).map(x => x.user_id)) }}- >- <div className="assignee-chip"- style={{- width: 22, height: 22, borderRadius: '50%', flexShrink: 0, cursor: canEdit ? 'pointer' : 'default',- background: `hsl(${a.username.charCodeAt(0) * 37 % 360}, 55%, 55%)`,- display: 'flex', alignItems: 'center', justifyContent: 'center',- fontSize: 'calc(10px * var(--fs-scale-caption, 1))', fontWeight: 700, color: 'white', textTransform: 'uppercase',- border: '2px solid var(--bg-card)', transition: 'opacity 0.15s',- }}+ {assignees.map(a => {+ // The chip is only ever clickable for an editor, so read-only members+ // get the plain div back rather than a focusable stop that does nothing.+ const chip = (+ <>+ <div className="assignee-chip"+ style={{+ width: 22, height: 22, borderRadius: '50%', flexShrink: 0, cursor: canEdit ? 'pointer' : 'default',+ background: `hsl(${(a.username.codePointAt(0) ?? 0) * 37 % 360}, 55%, 55%)`,+ display: 'flex', alignItems: 'center', justifyContent: 'center',+ fontSize: 'calc(10px * var(--fs-scale-caption, 1))', fontWeight: 700, color: 'white', textTransform: 'uppercase',+ border: '2px solid var(--bg-card)', transition: 'opacity 0.15s',+ }}+ >+ {a.username[0]}+ </div>+ <div className="assignee-tooltip" style={{+ position: 'absolute', top: '100%', left: '50%', transform: 'translateX(-50%)',+ marginTop: 6, padding: '3px 8px', borderRadius: 6, zIndex: 60,+ background: 'var(--text-primary)', color: 'var(--bg-primary)',+ fontSize: 'calc(10px * var(--fs-scale-caption, 1))', fontWeight: 600, whiteSpace: 'nowrap',+ pointerEvents: 'none', opacity: 0, transition: 'opacity 0.15s',+ }}>+ {a.username}+ </div>+ </>+ )+ if (!canEdit) return <div key={a.user_id} style={{ position: 'relative' }}>{chip}</div>+ return (+ <button type="button" key={a.user_id}+ style={{ position: 'relative', background: 'none', border: 'none', padding: 0, font: 'inherit', cursor: 'pointer' }}+ onClick={e => { e.stopPropagation(); onSetAssignees(kategorie, assignees.filter(x => x.user_id !== a.user_id).map(x => x.user_id)) }}>- {a.username[0]}- </div>- <div className="assignee-tooltip" style={{- position: 'absolute', top: '100%', left: '50%', transform: 'translateX(-50%)',- marginTop: 6, padding: '3px 8px', borderRadius: 6, zIndex: 60,- background: 'var(--text-primary)', color: 'var(--bg-primary)',- fontSize: 'calc(10px * var(--fs-scale-caption, 1))', fontWeight: 600, whiteSpace: 'nowrap',- pointerEvents: 'none', opacity: 0, transition: 'opacity 0.15s',- }}>- {a.username}- </div>- </div>- ))}+ {chip}+ </button>+ )+ })}{canEdit && (<div ref={assigneeDropdownRef} style={{ position: 'relative' }}><button type="button" onClick={e => { e.stopPropagation(); setShowAssigneeDropdown(v => !v) }}@@ -204,7 +215,7 @@ export function KategorieGruppe({ kategorie, items, tripId, allCategories, onRen><div style={{width: 20, height: 20, borderRadius: '50%', flexShrink: 0,- background: `hsl(${m.username.charCodeAt(0) * 37 % 360}, 55%, 55%)`,+ background: `hsl(${(m.username.codePointAt(0) ?? 0) * 37 % 360}, 55%, 55%)`,display: 'flex', alignItems: 'center', justifyContent: 'center',fontSize: 'calc(10px * var(--fs-scale-caption, 1))', fontWeight: 700, color: 'white', textTransform: 'uppercase',}}>@@ -244,7 +255,7 @@ export function KategorieGruppe({ kategorie, items, tripId, allCategories, onRenconst rect = menuBtnRef.current?.getBoundingClientRect();return (<>- <div style={{ position: 'fixed', inset: 0, zIndex: 99 }} onClick={() => setShowMenu(false)} />+ <div role="presentation" style={{ position: 'fixed', inset: 0, zIndex: 99 }} onClick={() => setShowMenu(false)} /><div style={{ position: 'fixed', right: rect ? window.innerWidth - rect.right : 0, top: rect ? rect.bottom + 4 : 0, zIndex: 100, background: 'var(--bg-card)', border: '1px solid var(--border-primary)', borderRadius: 10, boxShadow: '0 4px 16px rgba(0,0,0,0.1)', padding: 4, minWidth: 170 }}>{canEdit && <MenuItem icon={<Pencil size={13} />} label={t('packing.menuRename')} onClick={() => { setEditingName(true); setShowMenu(false) }} />}<MenuItem icon={<CheckCheck size={13} />} label={t('packing.menuCheckAll')} onClick={() => { handleCheckAll(); setShowMenu(false) }} />diff --git a/client/src/components/Packing/PackingListPanelImportModal.tsx b/client/src/components/Packing/PackingListPanelImportModal.tsxindex 1f1faed84..a40e7f506 100644--- a/client/src/components/Packing/PackingListPanelImportModal.tsx+++ b/client/src/components/Packing/PackingListPanelImportModal.tsx@@ -9,12 +9,12 @@ export function BulkImportModal(S: PackingState) {position: 'fixed', inset: 0, zIndex: 1000,display: 'flex', alignItems: 'center', justifyContent: 'center',background: 'rgba(0,0,0,0.3)', backdropFilter: 'blur(3px)',- }} onClick={() => setShowImportModal(false)}>+ }} role="presentation" onClick={e => { if (e.target === e.currentTarget) setShowImportModal(false) }}><div style={{width: 420, maxHeight: '80vh', background: 'var(--bg-card)', borderRadius: 16,boxShadow: '0 16px 48px rgba(0,0,0,0.22)', padding: '22px 22px 18px',display: 'flex', flexDirection: 'column', gap: 14,- }} onClick={e => e.stopPropagation()}>+ }}><div style={{ fontSize: 'calc(15px * var(--fs-scale-subtitle, 1))', fontWeight: 600, color: 'var(--text-primary)' }}>{t('packing.importTitle')}</div><div style={{ fontSize: 'calc(12px * var(--fs-scale-body, 1))', color: 'var(--text-faint)', lineHeight: 1.5 }}>{t('packing.importHint')}</div><div style={{ display: 'flex', border: '1px solid var(--border-primary)', borderRadius: 10, overflow: 'hidden', background: 'var(--bg-input)' }}>diff --git a/client/src/components/Packing/PackingListPanelItemRow.tsx b/client/src/components/Packing/PackingListPanelItemRow.tsxindex 4ca8b65f3..2e9ed665e 100644--- a/client/src/components/Packing/PackingListPanelItemRow.tsx+++ b/client/src/components/Packing/PackingListPanelItemRow.tsx@@ -1,4 +1,4 @@-import { useRef, useState, type ReactNode } from 'react'+import { useRef, useState, type CSSProperties, type ReactNode } from 'react'import { useTripStore } from '../../store/tripStore'import { useToast } from '../shared/Toast'import { useTranslation } from '../../i18n'@@ -94,6 +94,17 @@ export function ArtikelZeile({ item, tripId, categories, onCategoryChange: _onCaconst canDrag = canEdit && !isPlaceholder && !!dragconst selectedBag = bags.find(b => b.id === item.bag_id)+ // Shared by both shells of the name: a renameable name is a real button so+ // the rename can be reached with the keyboard, everything else is plain text.+ const nameStyle: CSSProperties = {+ flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',+ fontSize: 'calc(13.5px * var(--fs-scale-body, 1))',+ cursor: !canEdit || item.checked ? 'default' : 'text',+ color: isPlaceholder ? 'var(--text-faint)' : (item.checked ? 'var(--text-faint)' : 'var(--text-primary)'),+ transition: 'color 200ms cubic-bezier(0.23,1,0.32,1)',+ textDecoration: item.checked ? 'line-through' : 'none',+ }+return (<divclassName="group packing-item-row"@@ -151,19 +162,17 @@ export function ArtikelZeile({ item, tripId, categories, onCategoryChange: _onCaonKeyDown={e => { if (e.key === 'Enter') handleSaveName(); if (e.key === 'Escape') { setEditing(false); setEditName(isPlaceholder ? '' : item.name) } }}style={{ flex: 1, minWidth: 0, fontSize: 'calc(13.5px * var(--fs-scale-body, 1))', padding: '2px 8px', borderRadius: 6, border: '1px solid var(--border-primary)', outline: 'none', fontFamily: 'inherit' }}/>- ) : (- <span- onClick={() => canEdit && !item.checked && setEditing(true)}- style={{- flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',- fontSize: 'calc(13.5px * var(--fs-scale-body, 1))',- cursor: !canEdit || item.checked ? 'default' : 'text',- color: isPlaceholder ? 'var(--text-faint)' : (item.checked ? 'var(--text-faint)' : 'var(--text-primary)'),- transition: 'color 200ms cubic-bezier(0.23,1,0.32,1)',- textDecoration: item.checked ? 'line-through' : 'none',- }}+ ) : canEdit && !item.checked ? (+ <button+ type="button"+ onClick={() => setEditing(true)}+ style={{ ...nameStyle, border: 'none', background: 'none', padding: 0, textAlign: 'left', fontFamily: 'inherit' }}>{item.name}+ </button>+ ) : (+ <span style={nameStyle}>+ {item.name}</span>)}@@ -356,7 +365,7 @@ export function ArtikelZeile({ item, tripId, categories, onCategoryChange: _onCaconst rect = itemMenuBtnRef.current?.getBoundingClientRect()return (<>- <div style={{ position: 'fixed', inset: 0, zIndex: 1098 }} onClick={() => { setShowItemMenu(false); setShowMenuCategories(false) }} />+ <div role="presentation" style={{ position: 'fixed', inset: 0, zIndex: 1098 }} onClick={() => { setShowItemMenu(false); setShowMenuCategories(false) }} /><div className="trek-menu-enter" style={{position: 'fixed',right: rect ? Math.max(8, window.innerWidth - rect.right) : 8,diff --git a/client/src/components/Packing/PackingListPanelViewTabs.tsx b/client/src/components/Packing/PackingListPanelViewTabs.tsxindex de93a59b1..27729158d 100644--- a/client/src/components/Packing/PackingListPanelViewTabs.tsx+++ b/client/src/components/Packing/PackingListPanelViewTabs.tsx@@ -20,7 +20,7 @@ export function PackingViewTabs(S: PackingState) {const viewPill = (id: 'common' | 'personal', icon: React.ReactNode, label: string, count: number) => {const active = view === idreturn (- <button onClick={() => setView(id)} style={{+ <button type="button" onClick={() => setView(id)} style={{...pillBase,background: active ? 'var(--text-primary)' : 'transparent',borderColor: active ? 'var(--text-primary)' : 'var(--border-primary)',@@ -39,7 +39,7 @@ export function PackingViewTabs(S: PackingState) {const filterPill = (id: string, label: string) => {const active = filter === idreturn (- <button key={id} onClick={() => setFilter(id)} style={{+ <button type="button" key={id} onClick={() => setFilter(id)} style={{...pillBase, gap: 0, border: '1px solid transparent', fontWeight: active ? 600 : 400,background: active ? 'var(--text-primary)' : 'transparent',color: active ? 'var(--bg-primary)' : 'var(--text-muted)',diff --git a/client/src/components/Packing/PackingShareControl.tsx b/client/src/components/Packing/PackingShareControl.tsxindex 0eb85d93d..39ff7d11b 100644--- a/client/src/components/Packing/PackingShareControl.tsx+++ b/client/src/components/Packing/PackingShareControl.tsx@@ -80,7 +80,7 @@ export default function PackingShareControl({ item, tripMembers, currentUserId,</button>{open && pos && createPortal(<>- <div style={{ position: 'fixed', inset: 0, zIndex: 1099 }} onClick={() => setOpen(false)} />+ <div role="presentation" style={{ position: 'fixed', inset: 0, zIndex: 1099 }} onClick={() => setOpen(false)} /><div style={{position: 'fixed', top: pos.top, right: pos.right, zIndex: 1100,background: 'var(--bg-card)', border: '1px solid var(--border-primary)', borderRadius: 10,@@ -101,7 +101,7 @@ export default function PackingShareControl({ item, tripMembers, currentUserId,style={{ display: 'flex', alignItems: 'center', gap: 8, width: '100%', padding: '6px 10px', borderRadius: 7, border: 'none', cursor: 'pointer', background: 'none', fontFamily: 'inherit', fontSize: 'calc(12px * var(--fs-scale-body, 1))', color: 'var(--text-primary)' }}onMouseEnter={e => e.currentTarget.style.background = 'var(--bg-tertiary)'}onMouseLeave={e => e.currentTarget.style.background = 'none'}>- <span style={{ width: 18, height: 18, borderRadius: '50%', flexShrink: 0, background: `hsl(${m.username.charCodeAt(0) * 37 % 360}, 55%, 55%)`, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 'calc(9px * var(--fs-scale-caption, 1))', fontWeight: 700, color: 'white', textTransform: 'uppercase' }}>{m.username[0]}</span>+ <span style={{ width: 18, height: 18, borderRadius: '50%', flexShrink: 0, background: `hsl(${(m.username.codePointAt(0) ?? 0) * 37 % 360}, 55%, 55%)`, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 'calc(9px * var(--fs-scale-caption, 1))', fontWeight: 700, color: 'white', textTransform: 'uppercase' }}>{m.username[0]}</span><span style={{ flex: 1, textAlign: 'left', overflow: 'hidden', textOverflow: 'ellipsis' }}>{m.username}</span>{on && <Check size={13} className="text-content-muted" />}</button>diff --git a/client/src/components/Packing/packingListPanel.helpers.ts b/client/src/components/Packing/packingListPanel.helpers.tsindex 80cdf59ca..659bf94f1 100644--- a/client/src/components/Packing/packingListPanel.helpers.ts+++ b/client/src/components/Packing/packingListPanel.helpers.ts@@ -6,7 +6,7 @@ export function katColor(kat: string, allCategories?: string[]): string {if (idx >= 0) return KAT_COLORS[idx % KAT_COLORS.length]// Fallback: hash-basedlet h = 0- for (let i = 0; i < kat.length; i++) h = ((h << 5) - h + kat.charCodeAt(i)) | 0+ for (let i = 0; i < kat.length; i++) h = ((h << 5) - h + (kat.codePointAt(i) ?? 0)) | 0return KAT_COLORS[Math.abs(h) % KAT_COLORS.length]}diff --git a/client/src/components/Planner/AirTrailImportModal.tsx b/client/src/components/Planner/AirTrailImportModal.tsxindex 6e62cc86f..3e7bb09cd 100644--- a/client/src/components/Planner/AirTrailImportModal.tsx+++ b/client/src/components/Planner/AirTrailImportModal.tsx@@ -311,6 +311,7 @@ export default function AirTrailImportModal({ isOpen, onClose, tripId, pushUndo<divclassName="bg-[rgba(0,0,0,0.4)]"style={{ position: 'fixed', inset: 0, zIndex: 99999, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}+ role="presentation"onMouseDown={e => { mouseDownTarget.current = e.target }}onClick={e => {if (e.target === e.currentTarget && mouseDownTarget.current === e.currentTarget) handleClose()@@ -318,6 +319,7 @@ export default function AirTrailImportModal({ isOpen, onClose, tripId, pushUndo}}><div+ role="presentation"onClick={e => e.stopPropagation()}className="bg-surface-card"style={{ borderRadius: 16, width: '100%', maxWidth: 540, padding: 24, boxShadow: '0 8px 32px rgba(0,0,0,0.2)', fontFamily: 'var(--font-system)', maxHeight: '90vh', display: 'flex', flexDirection: 'column' }}diff --git a/client/src/components/Planner/BookingImportModal.tsx b/client/src/components/Planner/BookingImportModal.tsxindex 687c4b5d4..ba10feacc 100644--- a/client/src/components/Planner/BookingImportModal.tsx+++ b/client/src/components/Planner/BookingImportModal.tsx@@ -112,6 +112,7 @@ export default function BookingImportModal({ isOpen, onClose, tripId }: BookingIreturn createPortal(<div+ role="presentation"className="bg-[rgba(0,0,0,0.4)]"style={{ position: 'fixed', inset: 0, zIndex: 99999, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}onMouseDown={(e) => { mouseDownTarget.current = e.target }}@@ -121,6 +122,7 @@ export default function BookingImportModal({ isOpen, onClose, tripId }: BookingI}}><div+ role="presentation"onClick={(e) => e.stopPropagation()}className="bg-surface-card"style={{ borderRadius: 16, width: '100%', maxWidth: 540, padding: 24, boxShadow: '0 8px 32px rgba(0,0,0,0.2)', fontFamily: 'var(--font-system)', maxHeight: '90vh', display: 'flex', flexDirection: 'column' }}@@ -149,7 +151,8 @@ export default function BookingImportModal({ isOpen, onClose, tripId }: BookingIonChange={handleInputChange}/>- <div+ <button+ type="button"onClick={() => fileInputRef.current?.click()}onDragOver={handleDragOver}onDragEnter={handleDragOver}@@ -173,7 +176,7 @@ export default function BookingImportModal({ isOpen, onClose, tripId }: BookingI) : (<span style={{ color: 'var(--text-faint)', textAlign: 'center', pointerEvents: 'none' }}>{t('reservations.import.dropHere')}</span>)}- </div>+ </button>{error && (<div className="bg-[rgba(239,68,68,0.08)] text-[#b91c1c]" style={{ border: '1px solid rgba(239,68,68,0.35)', borderRadius: 10, padding: '8px 10px', fontSize: 'calc(12px * var(--fs-scale-body, 1))', whiteSpace: 'pre-wrap', marginTop: 8 }}>diff --git a/client/src/components/Planner/DayDetailPanel.tsx b/client/src/components/Planner/DayDetailPanel.tsxindex 4e6573885..af74df7f3 100644--- a/client/src/components/Planner/DayDetailPanel.tsx+++ b/client/src/components/Planner/DayDetailPanel.tsx@@ -144,8 +144,12 @@ export default function DayDetailPanel({ day, days, places, categories = [], triboxShadow: '0 8px 40px rgba(0,0,0,0.14), 0 0 0 1px rgba(0,0,0,0.06)',overflow: 'hidden', maxHeight: collapsed ? 'none' : '60vh', display: 'flex', flexDirection: 'column',}}>- {/* Header */}- <div style={{ display: 'flex', alignItems: 'center', gap: 14, padding: collapsed ? '12px 16px 12px 20px' : '18px 16px 14px 20px', borderBottom: collapsed ? 'none' : '1px solid var(--border-faint)', cursor: 'pointer' }}+ {/* Header. Clicking the bar collapses the panel, but that is a mouse+ shortcut for the chevron button below, a real button with a title that+ does the same thing. So the bar declares itself presentational instead+ of becoming a second, unlabelled tab stop wrapped around the rename+ input and the two icon buttons. */}+ <div role="presentation" style={{ display: 'flex', alignItems: 'center', gap: 14, padding: collapsed ? '12px 16px 12px 20px' : '18px 16px 14px 20px', borderBottom: collapsed ? 'none' : '1px solid var(--border-faint)', cursor: 'pointer' }}onClick={() => toggleCollapse()}><div className="bg-surface-secondary" style={{ width: collapsed ? 36 : 44, height: collapsed ? 36 : 44, borderRadius: 12, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0, transition: 'all 0.15s ease' }}><Calendar size={collapsed ? 16 : 20} className="text-content" />@@ -200,7 +204,7 @@ export default function DayDetailPanel({ day, days, places, categories = [], tri<div style={{ overflowY: 'auto', padding: '14px 20px 18px', display: collapsed ? 'none' : 'block' }}>{/* ── Weather ── */}- {day.date && lat && lng && (+ {!!(day.date && lat && lng) && (loading ? (<div style={{ textAlign: 'center', padding: 16, color: 'var(--text-faint)', fontSize: 'calc(12px * var(--fs-scale-body, 1))' }}><div style={{ width: 18, height: 18, border: '2px solid var(--border-primary)', borderTopColor: 'var(--text-primary)', borderRadius: '50%', animation: 'spin 0.8s linear infinite', margin: '0 auto 6px' }} />@@ -285,7 +289,7 @@ export default function DayDetailPanel({ day, days, places, categories = [], triif (dayReservations.length === 0) return nullreturn (<div style={{ marginBottom: 0 }}>- {day.date && lat && lng && <div style={{ height: 1, background: 'var(--border-faint)', margin: '12px 0' }} />}+ {!!(day.date && lat && lng) && <div style={{ height: 1, background: 'var(--border-faint)', margin: '12px 0' }} />}<div className="text-content-faint" style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', fontWeight: 600, textTransform: 'uppercase', letterSpacing: '0.05em', marginBottom: 6 }}>{t('day.reservations')}</div><div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>{dayReservations.map(r => {@@ -400,7 +404,7 @@ function AccommodationList({ dayAccommodations, day, reservations, canEditDays,<div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '8px 12px' }}><div style={{ width: 36, height: 36, borderRadius: 10, background: 'var(--bg-tertiary)', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>{acc.place_image ? (- <img src={acc.place_image} style={{ width: '100%', height: '100%', borderRadius: 10, objectFit: 'cover' }} />+ <img src={acc.place_image} alt="" style={{ width: '100%', height: '100%', borderRadius: 10, objectFit: 'cover' }} />) : (<Hotel size={16} style={{ color: 'var(--text-muted)' }} />)}@@ -454,12 +458,17 @@ function AccommodationList({ dayAccommodations, day, reservations, canEditDays,<div style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', fontWeight: 600, color: 'var(--text-primary)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{linked.title}</div><div style={{ fontSize: 'calc(9px * var(--fs-scale-caption, 1))', color: 'var(--text-faint)', display: 'flex', gap: 6, marginTop: 1 }}><span>{confirmed ? t('reservations.confirmed') : t('reservations.pending')}</span>- {linked.confirmation_number && <span+ {/* Reveal toggle for a blurred code: a real button, so it can+ be reached by keyboard. With blurring off there is nothing+ to toggle, and it stays out of the tab order. */}+ {linked.confirmation_number && <button+ type="button"+ disabled={!blurCodes}onMouseEnter={e => { if (blurCodes) e.currentTarget.style.filter = 'none' }}onMouseLeave={e => { if (blurCodes) e.currentTarget.style.filter = 'blur(4px)' }}onClick={e => { if (blurCodes) { const el = e.currentTarget; el.style.filter = el.style.filter === 'none' ? 'blur(4px)' : 'none' } }}- style={{ filter: blurCodes ? 'blur(4px)' : 'none', transition: 'filter 0.2s', cursor: blurCodes ? 'pointer' : 'default' }}- >#{linked.confirmation_number}</span>}+ style={{ filter: blurCodes ? 'blur(4px)' : 'none', transition: 'filter 0.2s', cursor: blurCodes ? 'pointer' : 'default', background: 'none', border: 'none', padding: 0, font: 'inherit', color: 'inherit' }}+ >#{linked.confirmation_number}</button>}</div></div></div>@@ -535,9 +544,12 @@ function HotelPickerModal({ showHotelPicker, setShowHotelPicker, font, t, hotelD<>{/* Hotel Picker Popup — portal to body to escape transform stacking context */}{showHotelPicker && createPortal(- <div style={{ position: 'fixed', inset: 0, zIndex: 99999, background: 'rgba(0,0,0,0.4)', backdropFilter: 'blur(4px)', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}+ // Click screen and the card that stops the click from reaching it:+ // neither is a control, and the popup has its own X and Cancel+ // buttons, so both stay presentational.+ <div role="presentation" style={{ position: 'fixed', inset: 0, zIndex: 99999, background: 'rgba(0,0,0,0.4)', backdropFilter: 'blur(4px)', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}onClick={() => setShowHotelPicker(false)}>- <div onClick={e => e.stopPropagation()} style={{+ <div role="presentation" onClick={e => e.stopPropagation()} style={{width: '100%', maxWidth: 900, borderRadius: 16, overflow: 'hidden',background: 'var(--bg-card)', boxShadow: '0 20px 60px rgba(0,0,0,0.2)',...font,@@ -655,7 +667,7 @@ function HotelPickerModal({ showHotelPicker, setShowHotelPicker, font, t, hotelD><div style={{ width: 32, height: 32, borderRadius: 8, background: 'var(--bg-secondary)', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>{p.image_url ? (- <img src={p.image_url} style={{ width: '100%', height: '100%', borderRadius: 8, objectFit: 'cover' }} />+ <img src={p.image_url} alt="" style={{ width: '100%', height: '100%', borderRadius: 8, objectFit: 'cover' }} />) : (<MapPin size={13} style={{ color: 'var(--text-faint)' }} />)}diff --git a/client/src/components/Planner/DayPlanSidebar.tsx b/client/src/components/Planner/DayPlanSidebar.tsxindex c6e4c17a2..91b410e08 100644--- a/client/src/components/Planner/DayPlanSidebar.tsx+++ b/client/src/components/Planner/DayPlanSidebar.tsx@@ -1466,6 +1466,20 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP{ label: t('dayplan.transportMode.useDefault'), icon: RotateCcw, onClick: () => setIncomingLegMode(assignmentId, dayId, null) },])}++ // Enter/Space on a route connector opens the same mode menu a click opens. A key+ // event carries no pointer position, so the menu is anchored to the connector.+ const openLegMenuByKey = (e: React.KeyboardEvent<HTMLDivElement>, open: (m: React.MouseEvent) => void) => {+ if (e.key !== 'Enter' && e.key !== ' ') return+ const rect = e.currentTarget.getBoundingClientRect()+ open({+ clientX: rect.left,+ clientY: rect.bottom,+ preventDefault: () => e.preventDefault(),+ stopPropagation: () => e.stopPropagation(),+ } as unknown as React.MouseEvent)+ }+return (<div data-touch-drag={dragDisabled ? undefined : ''} style={{ display: 'flex', flexDirection: 'column', height: '100%', position: 'relative', fontFamily: "var(--font-system)" }}>{/* Toolbar */}@@ -1500,6 +1514,13 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP<div className={`scroll-container${draggingId ? '' : ' trek-stagger'}`} style={{ flex: 1, overflowY: 'auto', minHeight: 0 }} ref={scrollContainerRef} onScroll={(e) => onScrollTopChange?.((e.currentTarget as HTMLElement).scrollTop)}>{days.map((day, index) => {const isSelected = selectedDayId === day.id+ // Shared by the click and the key handler so the two can never drift+ // apart — pressing Enter on the row has to toggle, not just select.+ // Named for the selection, not the expand/collapse `toggleDay` above.+ const toggleDaySelection = () => {+ if (isSelected) { onSelectDay(null); if (onDayDetail) onDayDetail(null) }+ else { onSelectDay(day.id); if (onDayDetail) onDayDetail(day) }+ }const isExpanded = expandedDays.has(day.id)const da = getDayAssignments(day.id)const cost = dayTotalCost(day.id, assignments, costBase, currency, locale, fxRates)@@ -1580,7 +1601,19 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarPclassName="dp-day-header"data-selected={isSelected}// Clicking the selected day again deselects it — same as the day panel's × (#2024).- onClick={() => { if (isSelected) { onSelectDay(null); if (onDayDetail) onDayDetail(null) } else { onSelectDay(day.id); if (onDayDetail) onDayDetail(day) } }}+ // Selecting the day has no other trigger, so the row carries the+ // button role itself. The badges inside it are buttons of their+ // own, hence the key handler only answers for the row — and it+ // toggles exactly like the click, rather than only selecting.+ role="button"+ tabIndex={0}+ onClick={() => toggleDaySelection()}+ onKeyDown={e => {+ if (e.target !== e.currentTarget) return+ if (e.key !== 'Enter' && e.key !== ' ') return+ e.preventDefault()+ toggleDaySelection()+ }}onDragOver={e => { e.preventDefault(); if (dragOverDayId !== day.id) setDragOverDayId(day.id) }}onDragLeave={e => { if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setDragOverDayId(null) }}onDrop={e => handleDropOnDay(e, day.id)}@@ -1686,10 +1719,10 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarPconst isCheckOut = acc.end_day_id === day.idconst iconColor = isCheckOut && !isCheckIn ? '#ef4444' : isCheckIn ? '#22c55e' : 'var(--text-faint)'return (- <span key={acc.id} onClick={e => { e.stopPropagation(); if ((acc as any).place_id) onPlaceClick((acc as any).place_id) }} className="bg-surface-hover" style={{ display: 'inline-flex', alignItems: 'center', gap: 4, flexShrink: 1, minWidth: 0, cursor: (acc as any).place_id ? 'pointer' : 'default', borderRadius: 7, padding: '2px 7px 2px 6px' }}>+ <button type="button" key={acc.id} onClick={e => { e.stopPropagation(); if ((acc as any).place_id) onPlaceClick((acc as any).place_id) }} className="bg-surface-hover" style={{ display: 'inline-flex', alignItems: 'center', gap: 4, flexShrink: 1, minWidth: 0, cursor: (acc as any).place_id ? 'pointer' : 'default', borderRadius: 7, padding: '2px 7px 2px 6px', border: 'none', font: 'inherit', textAlign: 'left' }}><Hotel size={11} strokeWidth={1.8} style={{ color: iconColor, flexShrink: 0 }} /><span className="text-content-muted" style={{ fontSize: 'calc(10.5px * var(--fs-scale-caption, 1))', fontWeight: 400, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{(acc as any).place_name || (acc as any).reservation_title}</span>- </span>+ </button>)})})()}@@ -1698,10 +1731,10 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarPconst activeRentals = getActiveRentalsForDay(day.id)if (activeRentals.length === 0) return nullreturn activeRentals.map(r => (- <span key={`rental-${r.id}`} onClick={e => { e.stopPropagation(); setTransportDetail(r) }} className="bg-surface-hover" style={{ display: 'inline-flex', alignItems: 'center', gap: 4, flexShrink: 1, minWidth: 0, cursor: 'pointer', borderRadius: 7, padding: '2px 7px 2px 6px' }}>+ <button type="button" key={`rental-${r.id}`} onClick={e => { e.stopPropagation(); setTransportDetail(r) }} className="bg-surface-hover" style={{ display: 'inline-flex', alignItems: 'center', gap: 4, flexShrink: 1, minWidth: 0, cursor: 'pointer', borderRadius: 7, padding: '2px 7px 2px 6px', border: 'none', font: 'inherit', textAlign: 'left' }}><Car size={11} strokeWidth={1.8} className="text-content-faint" style={{ flexShrink: 0 }} /><span className="text-content-muted" style={{ fontSize: 'calc(10.5px * var(--fs-scale-caption, 1))', fontWeight: 400, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{r.title}</span>- </span>+ </button>))})()}</div>@@ -1721,19 +1754,19 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP{/* Public transit search (#1065) — replaced the rename pencil,which moved next to the day name in the day detail view. */}{onPlanTransit ? (- <button onClick={e => { e.stopPropagation(); onPlanTransit(day.id) }} title={t('transit.title')} aria-label={t('transit.title')} style={{ ...cell, border: 'none', borderRight: div, borderBottom: div }}>+ <button type="button" onClick={e => { e.stopPropagation(); onPlanTransit(day.id) }} title={t('transit.title')} aria-label={t('transit.title')} style={{ ...cell, border: 'none', borderRight: div, borderBottom: div }}><TramFront size={14} strokeWidth={1.8} /></button>) : <div style={{ borderRight: div, borderBottom: div }} />}{onAddTransport ? (- <button onClick={e => { e.stopPropagation(); onAddTransport(day.id) }} title={t('transport.addTransport')} style={{ ...cell, border: 'none', borderBottom: div }}>+ <button type="button" onClick={e => { e.stopPropagation(); onAddTransport(day.id) }} title={t('transport.addTransport')} style={{ ...cell, border: 'none', borderBottom: div }}><Plus size={14} strokeWidth={1.8} /></button>) : <div style={{ borderBottom: div }} />}- <button onClick={e => openAddNote(day.id, e)} aria-label={t('dayplan.addNote')} style={{ ...cell, border: 'none', borderRight: div }}>+ <button type="button" onClick={e => openAddNote(day.id, e)} aria-label={t('dayplan.addNote')} style={{ ...cell, border: 'none', borderRight: div }}><FileText size={14} strokeWidth={1.8} /></button>- <button onClick={e => toggleDay(day.id, e)} title={isExpanded ? t('common.collapse') : t('common.expand')} style={{ ...cell, border: 'none' }}>+ <button type="button" onClick={e => toggleDay(day.id, e)} title={isExpanded ? t('common.collapse') : t('common.expand')} style={{ ...cell, border: 'none' }}>{isExpanded ? <ChevronDown size={15} strokeWidth={1.8} /> : <ChevronRight size={15} strokeWidth={1.8} />}</button></div>@@ -1816,7 +1849,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarPconst targetId = hotelLegs[day.id]?.top?.targetIdconst connector = <HotelRouteConnector seg={hotelLegs[day.id]!.top!.seg} name={hotelLegs[day.id]!.top!.name} profile={routeProfile} placement="top" />return canEditDays && targetId != null ? (- <div role="button" tabIndex={0} title={t('dayplan.transportMode.change')} onClick={e => openIncomingLegModeMenu(e, targetId, day.id, hotelLegs[day.id]!.top!.seg)} style={{ cursor: 'pointer' }}>+ <div role="button" tabIndex={0} title={t('dayplan.transportMode.change')} onClick={e => openIncomingLegModeMenu(e, targetId, day.id, hotelLegs[day.id]!.top!.seg)} onKeyDown={e => openLegMenuByKey(e, m => openIncomingLegModeMenu(m, targetId, day.id, hotelLegs[day.id]!.top!.seg))} style={{ cursor: 'pointer' }}>{connector}</div>) : connector@@ -1890,11 +1923,18 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP}const moveUp = (e) => { e.stopPropagation(); arrowMove('up') }const moveDown = (e) => { e.stopPropagation(); arrowMove('down') }+ const selectPlace = () => { onPlaceClick(isPlaceSelected ? null : place.id, isPlaceSelected ? null : assignment.id); if (!isPlaceSelected) onSelectDay(day.id, true) }return (<React.Fragment key={`place-${assignment.id}`}><divclassName="dp-row"+ // Picking the place out of the day has no other trigger, so+ // the row is the control. Its grip, lock and arrows are+ // buttons in their own right, hence the key handler only+ // answers for the row itself.+ role="button"+ tabIndex={0}draggable={canEditDays && !dragDisabled}onDragStart={e => {if (!canEditDays || dragDisabled) { e.preventDefault(); return }@@ -1950,7 +1990,13 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP}}}onDragEnd={() => { setDraggingId(null); setDragOverDayId(null); setDropTargetKey(null); dragDataRef.current = null }}- onClick={() => { onPlaceClick(isPlaceSelected ? null : place.id, isPlaceSelected ? null : assignment.id); if (!isPlaceSelected) onSelectDay(day.id, true) }}+ onClick={selectPlace}+ onKeyDown={e => {+ if (e.target !== e.currentTarget) return+ if (e.key !== 'Enter' && e.key !== ' ') return+ e.preventDefault()+ selectPlace()+ }}onContextMenu={e => {// Flat entries, one per app: the menu has room to// grow and a submenu would need a component that@@ -1998,11 +2044,13 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP{canEditDays && !dragDisabled && <div className="dp-grip" style={{ flexShrink: 0, color: 'var(--text-faint)', display: 'flex', alignItems: 'center', opacity: 0.3, transition: 'opacity 0.15s', cursor: 'grab' }}><GripVertical size={13} strokeWidth={1.8} /></div>}- <div+ <button+ type="button"+ aria-label={lockedIds.has(assignment.id) ? t('planner.clickToUnlock') : t('planner.keepPosition')}onClick={e => { e.stopPropagation(); toggleLock(assignment.id) }}onMouseEnter={e => { e.stopPropagation(); setLockHoverId(assignment.id) }}onMouseLeave={() => setLockHoverId(null)}- style={{ position: 'relative', flexShrink: 0, cursor: 'pointer' }}+ style={{ position: 'relative', flexShrink: 0, cursor: 'pointer', display: 'flex', background: 'none', border: 'none', padding: 0, font: 'inherit' }}><PlaceAvatar place={place} category={cat} size={28} />{/* Hover/locked overlay */}@@ -2030,7 +2078,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP: t('planner.keepPosition')}</div>)}- </div>+ </button><div style={{ flex: 1, minWidth: 0 }}><div style={{ display: 'flex', alignItems: 'center', gap: 4, overflow: 'hidden' }}>{cat && (() => {@@ -2145,7 +2193,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarPmarginLeft: pi > 0 ? -4 : 0, flexShrink: 0,overflow: 'hidden',}}>- {p.avatar ? <img src={avatarSrc(p.avatar)!} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : p.username?.[0]?.toUpperCase()}+ {p.avatar ? <img src={avatarSrc(p.avatar)!} alt={p.username ?? ''} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : p.username?.[0]?.toUpperCase()}</div>))}{assignment.participants.length > 5 && (@@ -2191,7 +2239,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP</div>{daySchedule.byAssignment[day.id]?.[assignment.id]?.map(si => <PluginDayScheduleRow key={`${si.pluginId}:${si.id}`} item={si} />)}{routeLegs[day.id]?.[assignment.id] && (canEditDays ? (- <div role="button" tabIndex={0} title={t('dayplan.transportMode.change')} onClick={e => openLegModeMenu(e, assignment.id, day.id, routeLegs[day.id]![assignment.id])} style={{ cursor: 'pointer' }}>+ <div role="button" tabIndex={0} title={t('dayplan.transportMode.change')} onClick={e => openLegModeMenu(e, assignment.id, day.id, routeLegs[day.id]![assignment.id])} onKeyDown={e => openLegMenuByKey(e, m => openLegModeMenu(m, assignment.id, day.id, routeLegs[day.id]![assignment.id]))} style={{ cursor: 'pointer' }}><RouteConnector seg={routeLegs[day.id]![assignment.id]} profile={routeProfile} /></div>) : (@@ -2247,22 +2295,34 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarPconst displayTime = getDisplayTimeForDay(res, day.id)const legKey = res.__leg ? `leg${res.__leg.index}` : 'x'+ const openTransportRow = () => {+ const target = reservations.find(x => x.id === res.id) ?? res+ // A transit journey opens its own journey view — the rich+ // stop-by-stop breakdown with its booking fields, never the+ // generic edit form (#1065).+ if (transitMeta) {+ if (onOpenTransit) onOpenTransit(target)+ else setTransportDetail(target)+ return+ }+ if (!canEditDays) return+ if (TRANSPORT_TYPES.has(res.type)) onEditTransport?.(target)+ else onEditReservation?.(target)+ }+return (<React.Fragment key={`transport-${res.id}-${legKey}-${day.id}`}><div- onClick={() => {- const target = reservations.find(x => x.id === res.id) ?? res- // A transit journey opens its own journey view — the rich- // stop-by-stop breakdown with its booking fields, never the- // generic edit form (#1065).- if (transitMeta) {- if (onOpenTransit) onOpenTransit(target)- else setTransportDetail(target)- return- }- if (!canEditDays) return- if (TRANSPORT_TYPES.has(res.type)) onEditTransport?.(target)- else onEditReservation?.(target)+ // Opening the booking has no other trigger, so the row is+ // the control; the buttons inside it answer for themselves.+ role="button"+ tabIndex={0}+ onClick={openTransportRow}+ onKeyDown={e => {+ if (e.target !== e.currentTarget) return+ if (e.key !== 'Enter' && e.key !== ' ') return+ e.preventDefault()+ openTransportRow()}}onDragOver={e => {e.preventDefault(); e.stopPropagation()@@ -2433,7 +2493,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarPconst nextPlaceId = merged.slice(idx + 1).find(i => i.type === 'place' && i.data.place?.lat && i.data.place?.lng)?.data.idconst connector = <RouteConnector seg={routeLegs[day.id]![res.id]} profile={routeProfile} />return canEditDays && nextPlaceId != null ? (- <div role="button" tabIndex={0} title={t('dayplan.transportMode.change')} onClick={e => openIncomingLegModeMenu(e, Number(nextPlaceId), day.id, routeLegs[day.id]![res.id])} style={{ cursor: 'pointer' }}>+ <div role="button" tabIndex={0} title={t('dayplan.transportMode.change')} onClick={e => openIncomingLegModeMenu(e, Number(nextPlaceId), day.id, routeLegs[day.id]![res.id])} onKeyDown={e => openLegMenuByKey(e, m => openIncomingLegModeMenu(m, Number(nextPlaceId), day.id, routeLegs[day.id]![res.id]))} style={{ cursor: 'pointer' }}>{connector}</div>) : connector@@ -2567,7 +2627,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarPconst targetId = hotelLegs[day.id]?.bottom?.targetIdconst connector = <HotelRouteConnector seg={hotelLegs[day.id]!.bottom!.seg} name={hotelLegs[day.id]!.bottom!.name} profile={routeProfile} placement="bottom" />return canEditDays && targetId != null ? (- <div role="button" tabIndex={0} title={t('dayplan.transportMode.change')} onClick={e => openLegModeMenu(e, targetId, day.id, hotelLegs[day.id]!.bottom!.seg)} style={{ cursor: 'pointer' }}>+ <div role="button" tabIndex={0} title={t('dayplan.transportMode.change')} onClick={e => openLegModeMenu(e, targetId, day.id, hotelLegs[day.id]!.bottom!.seg)} onKeyDown={e => openLegMenuByKey(e, m => openLegModeMenu(m, targetId, day.id, hotelLegs[day.id]!.bottom!.seg))} style={{ cursor: 'pointer' }}>{connector}</div>) : connectordiff --git a/client/src/components/Planner/DayPlanSidebarNoteModal.tsx b/client/src/components/Planner/DayPlanSidebarNoteModal.tsxindex 7a87b2a44..50a78e0f1 100644--- a/client/src/components/Planner/DayPlanSidebarNoteModal.tsx+++ b/client/src/components/Planner/DayPlanSidebarNoteModal.tsx@@ -69,12 +69,12 @@ function NoteDialog({ dayId, ui, setNoteUi, noteInputRef, cancelNote, saveNote,position: 'fixed', inset: 0, zIndex: 10000,display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16,backdropFilter: 'blur(3px)',- }} onClick={() => cancelNote(Number(dayId))}>+ }} role="presentation" onClick={() => cancelNote(Number(dayId))}><div className="bg-surface-card note-modal" style={{width: '100%', maxWidth: 720, maxHeight: '90vh', overflowY: 'auto', borderRadius: 16,boxShadow: '0 16px 48px rgba(0,0,0,0.22)', padding: '22px 22px 18px',display: 'flex', flexDirection: 'column', gap: 16,- }} onClick={e => e.stopPropagation()}>+ }} role="presentation" onClick={e => e.stopPropagation()}><div className="text-content" style={{ fontSize: 'calc(15px * var(--fs-scale-subtitle, 1))', fontWeight: 600 }}>{ui.mode === 'add' ? t('dayplan.noteAdd') : t('dayplan.noteEdit')}</div>diff --git a/client/src/components/Planner/DayPlanSidebarTimeConfirmModal.tsx b/client/src/components/Planner/DayPlanSidebarTimeConfirmModal.tsxindex 21f207e6b..ff5b0bf87 100644--- a/client/src/components/Planner/DayPlanSidebarTimeConfirmModal.tsx+++ b/client/src/components/Planner/DayPlanSidebarTimeConfirmModal.tsx@@ -22,12 +22,12 @@ interface DayPlanSidebarTimeConfirmModalProps {export function DayPlanSidebarTimeConfirmModal({ timeConfirm, setTimeConfirm, confirmTimeRemoval, t }: DayPlanSidebarTimeConfirmModalProps) {if (!timeConfirm) return nullreturn createPortal(- <div className="bg-[rgba(0,0,0,0.3)]" style={{+ <div role="presentation" className="bg-[rgba(0,0,0,0.3)]" style={{position: 'fixed', inset: 0, zIndex: 1000,display: 'flex', alignItems: 'center', justifyContent: 'center',backdropFilter: 'blur(3px)',}} onClick={() => setTimeConfirm(null)}>- <div className="bg-surface-card" style={{+ <div role="presentation" className="bg-surface-card" style={{width: 340, borderRadius: 16,boxShadow: '0 16px 48px rgba(0,0,0,0.22)', padding: '22px 22px 18px',display: 'flex', flexDirection: 'column', gap: 12,diff --git a/client/src/components/Planner/DayPlanSidebarTransportDetailModal.tsx b/client/src/components/Planner/DayPlanSidebarTransportDetailModal.tsxindex 3df43e116..231e1e1ac 100644--- a/client/src/components/Planner/DayPlanSidebarTransportDetailModal.tsx+++ b/client/src/components/Planner/DayPlanSidebarTransportDetailModal.tsx@@ -30,8 +30,14 @@ export function DayPlanSidebarTransportDetailModal({position: 'fixed', inset: 0, zIndex: 1000,display: 'flex', alignItems: 'center', justifyContent: 'center',backdropFilter: 'blur(3px)',- }} onClick={() => setTransportDetail(null)}>- <div className="bg-surface-card" style={{+ }}+ role="button" tabIndex={0} aria-label={t('common.cancel')}+ onClick={() => setTransportDetail(null)}+ onKeyDown={e => {+ if (e.target !== e.currentTarget) return+ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setTransportDetail(null) }+ }}>+ <div className="bg-surface-card" role="presentation" style={{width: 380, maxHeight: '80vh', overflowY: 'auto',borderRadius: 16,boxShadow: '0 16px 48px rgba(0,0,0,0.22)', padding: '22px 22px 18px',@@ -109,21 +115,29 @@ export function DayPlanSidebarTransportDetailModal({<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }}>{detailFields.map((f, i) => {const shouldBlur = f.sensitive && useSettingsStore.getState().settings.blur_booking_codes+ const valueStyle = {+ fontSize: 'calc(12px * var(--fs-scale-body, 1))', fontWeight: 500, wordBreak: 'break-word',+ filter: shouldBlur ? 'blur(5px)' : 'none', transition: 'filter 0.2s',+ cursor: shouldBlur ? 'pointer' : 'default',+ userSelect: shouldBlur ? 'none' : 'auto',+ } as constreturn (<div key={i} className="bg-surface-tertiary" style={{ padding: '8px 10px', borderRadius: 8 }}><div className="text-content-faint" style={{ fontSize: 'calc(9px * var(--fs-scale-caption, 1))', fontWeight: 600, textTransform: 'uppercase', letterSpacing: '0.03em', marginBottom: 3 }}>{f.label}</div>- <div- onMouseEnter={e => { if (shouldBlur) e.currentTarget.style.filter = 'none' }}- onMouseLeave={e => { if (shouldBlur) e.currentTarget.style.filter = 'blur(5px)' }}- onClick={e => { if (shouldBlur) { const el = e.currentTarget; el.style.filter = el.style.filter === 'none' ? 'blur(5px)' : 'none' } }}- className="text-content"- style={{- fontSize: 'calc(12px * var(--fs-scale-body, 1))', fontWeight: 500, wordBreak: 'break-word',- filter: shouldBlur ? 'blur(5px)' : 'none', transition: 'filter 0.2s',- cursor: shouldBlur ? 'pointer' : 'default',- userSelect: shouldBlur ? 'none' : 'auto',- }}- >{f.value}</div>+ {/* A hidden booking code is a reveal toggle, so it has to be a real+ button; a plain value stays inert text and out of the tab order. */}+ {shouldBlur ? (+ <button+ type="button"+ onMouseEnter={e => { e.currentTarget.style.filter = 'none' }}+ onMouseLeave={e => { e.currentTarget.style.filter = 'blur(5px)' }}+ onClick={e => { const el = e.currentTarget; el.style.filter = el.style.filter === 'none' ? 'blur(5px)' : 'none' }}+ className="text-content"+ style={{ ...valueStyle, display: 'block', width: '100%', textAlign: 'left', background: 'none', border: 'none', padding: 0, fontFamily: 'inherit' }}+ >{f.value}</button>+ ) : (+ <div className="text-content" style={valueStyle}>{f.value}</div>+ )}</div>)})}@@ -215,12 +229,13 @@ export function DayPlanSidebarTransportDetailModal({<div className="text-content-faint" style={{ fontSize: 'calc(9px * var(--fs-scale-caption, 1))', fontWeight: 600, textTransform: 'uppercase', letterSpacing: '0.03em', marginBottom: 6 }}>{t('files.title')}</div><div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>{resFiles.map(f => (- <div key={f.id}+ <button key={f.id}+ type="button"onClick={() => { setTransportDetail(null); onNavigateToFiles?.() }}className="bg-surface-tertiary"style={{display: 'flex', alignItems: 'center', gap: 8, padding: '6px 10px',- borderRadius: 8, cursor: 'pointer',+ borderRadius: 8, cursor: 'pointer', border: 'none', textAlign: 'left', fontFamily: 'inherit',transition: 'background 0.1s',}}onMouseEnter={e => e.currentTarget.style.background = 'var(--bg-hover)'}@@ -231,7 +246,7 @@ export function DayPlanSidebarTransportDetailModal({{f.original_name}</span><ExternalLink size={11} className="text-content-faint" style={{ flexShrink: 0 }} />- </div>+ </button>))}</div></div>diff --git a/client/src/components/Planner/DayReorderPopup.tsx b/client/src/components/Planner/DayReorderPopup.tsxindex 009f7114a..aadd121b6 100644--- a/client/src/components/Planner/DayReorderPopup.tsx+++ b/client/src/components/Planner/DayReorderPopup.tsx@@ -123,6 +123,7 @@ export function DayReorderPopup({ isOpen, days, t, locale, onReorder, onAddDay,{label(day, index)}</span><button+ type="button"onClick={() => move(index, index - 1)}disabled={index === 0}aria-label={t('dayplan.moveUp')}@@ -131,6 +132,7 @@ export function DayReorderPopup({ isOpen, days, t, locale, onReorder, onAddDay,<ArrowUp size={14} strokeWidth={2} /></button><button+ type="button"onClick={() => move(index, index + 1)}disabled={index === ordered.length - 1}aria-label={t('dayplan.moveDown')}diff --git a/client/src/components/Planner/FileImportModal.tsx b/client/src/components/Planner/FileImportModal.tsxindex 70aaa2732..f65133bf2 100644--- a/client/src/components/Planner/FileImportModal.tsx+++ b/client/src/components/Planner/FileImportModal.tsx@@ -217,11 +217,13 @@ export default function FileImportModal({ isOpen, onClose, tripId, pushUndo, inireturn createPortal(<div+ role="presentation"onClick={handleClose}className="bg-[rgba(0,0,0,0.4)]"style={{ position: 'fixed', inset: 0, zIndex: 99999, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}><div+ role="presentation"onClick={e => e.stopPropagation()}className="bg-surface-card"style={{ borderRadius: 16, width: '100%', maxWidth: 520, padding: 24, boxShadow: '0 8px 32px rgba(0,0,0,0.2)', fontFamily: "var(--font-system)" }}@@ -242,7 +244,8 @@ export default function FileImportModal({ isOpen, onClose, tripId, pushUndo, inionChange={handleInputChange}/>- <div+ <button+ type="button"onClick={() => fileInputRef.current?.click()}onDragOver={handleDragOver}onDragEnter={handleDragOver}@@ -277,7 +280,7 @@ export default function FileImportModal({ isOpen, onClose, tripId, pushUndo, ini) : (<span style={{ color: 'var(--text-faint)', textAlign: 'center', pointerEvents: 'none' }}>{t('places.importFileDropHere')}</span>)}- </div>+ </button>{isGpx && (<div style={{ marginBottom: 12 }}>@@ -285,7 +288,7 @@ export default function FileImportModal({ isOpen, onClose, tripId, pushUndo, ini{t('places.gpxImportTypes')}</div>{(['waypoints', 'routes', 'tracks'] as const).map(key => (- <label key={key} onClick={() => setGpxOpts(prev => ({ ...prev, [key]: !prev[key] }))} style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '4px 0', cursor: 'pointer' }}>+ <button type="button" key={key} role="checkbox" aria-checked={gpxOpts[key]} onClick={() => setGpxOpts(prev => ({ ...prev, [key]: !prev[key] }))} style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '4px 0', cursor: 'pointer', width: '100%', border: 'none', background: 'transparent', fontFamily: 'inherit', textAlign: 'left' }}><div className={gpxOpts[key] ? 'bg-accent' : 'bg-transparent'} style={{width: 16, height: 16, borderRadius: 4, flexShrink: 0,border: gpxOpts[key] ? 'none' : '1.5px solid var(--border-primary)',@@ -296,7 +299,7 @@ export default function FileImportModal({ isOpen, onClose, tripId, pushUndo, ini<span style={{ fontSize: 'calc(12px * var(--fs-scale-body, 1))', color: 'var(--text-primary)', userSelect: 'none' }}>{t(key === 'waypoints' ? 'places.gpxImportWaypoints' : key === 'routes' ? 'places.gpxImportRoutes' : 'places.gpxImportTracks')}</span>- </label>+ </button>))}{gpxNoneSelected && (<div className="text-[#b45309]" style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', marginTop: 4 }}>{t('places.gpxImportNoneSelected')}</div>@@ -310,7 +313,7 @@ export default function FileImportModal({ isOpen, onClose, tripId, pushUndo, ini{t('places.kmlImportTypes')}</div>{(['points', 'paths'] as const).map(key => (- <label key={key} onClick={() => setKmlOpts(prev => ({ ...prev, [key]: !prev[key] }))} style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '4px 0', cursor: 'pointer' }}>+ <button type="button" key={key} role="checkbox" aria-checked={kmlOpts[key]} onClick={() => setKmlOpts(prev => ({ ...prev, [key]: !prev[key] }))} style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '4px 0', cursor: 'pointer', width: '100%', border: 'none', background: 'transparent', fontFamily: 'inherit', textAlign: 'left' }}><div className={kmlOpts[key] ? 'bg-accent' : 'bg-transparent'} style={{width: 16, height: 16, borderRadius: 4, flexShrink: 0,border: kmlOpts[key] ? 'none' : '1.5px solid var(--border-primary)',@@ -321,7 +324,7 @@ export default function FileImportModal({ isOpen, onClose, tripId, pushUndo, ini<span style={{ fontSize: 'calc(12px * var(--fs-scale-body, 1))', color: 'var(--text-primary)', userSelect: 'none' }}>{t(key === 'points' ? 'places.kmlImportPoints' : 'places.kmlImportPaths')}</span>- </label>+ </button>))}{kmlNoneSelected && (<div className="text-[#b45309]" style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', marginTop: 4 }}>{t('places.kmlImportNoneSelected')}</div>diff --git a/client/src/components/Planner/IcsSubscribeModal.tsx b/client/src/components/Planner/IcsSubscribeModal.tsxindex b9a89fffd..a5551408e 100644--- a/client/src/components/Planner/IcsSubscribeModal.tsx+++ b/client/src/components/Planner/IcsSubscribeModal.tsx@@ -63,6 +63,7 @@ export function IcsSubscribeModal({ endpoint, title, description, onClose }: Icsreturn createPortal(<div+ role="presentation"style={{position: 'fixed', inset: 0, zIndex: 9999,background: 'rgba(0,0,0,0.5)',diff --git a/client/src/components/Planner/PlaceFormModal.tsx b/client/src/components/Planner/PlaceFormModal.tsxindex 29ecd33af..9d1889d91 100644--- a/client/src/components/Planner/PlaceFormModal.tsx+++ b/client/src/components/Planner/PlaceFormModal.tsx@@ -838,7 +838,7 @@ export default function PlaceFormModal(props: PlaceFormModalProps) {onValueChange={v => handleChange('lat', v)}onPaste={e => {const text = e.clipboardData.getData('text').trim()- const match = text.match(/^(-?\d+\.?\d*)\s*[,;\s]\s*(-?\d+\.?\d*)$/)+ const match = text.match(/^(-?\d+(?:\.\d*)?)(?:\s*[,;]\s*|\s+)(-?\d+(?:\.\d*)?)$/)if (match) {e.preventDefault()handleChange('lat', match[1])@@ -913,7 +913,7 @@ export default function PlaceFormModal(props: PlaceFormModalProps) {context (itinerary edit, or a single-assignment pool edit). Hidden whencreating, and for unassigned / multi-day pool edits where a single timeis ambiguous and wouldn't persist. */}- {place && assignmentId && (+ {!!(place && assignmentId) && (<TimeSectionform={form}handleChange={handleChange}diff --git a/client/src/components/Planner/PlaceInspector.test.tsx b/client/src/components/Planner/PlaceInspector.test.tsxindex 6c464cad0..da54804c1 100644--- a/client/src/components/Planner/PlaceInspector.test.tsx+++ b/client/src/components/Planner/PlaceInspector.test.tsx@@ -1291,7 +1291,7 @@ describe('PlaceInspector', () => {it('FE-PLANNER-INSPECTOR-093: participant chips and the add menu reset their hover styling', () => {render(<PlaceInspector {...defaultProps} {...participantProps([{ user_id: 1 }, { user_id: 2 }])} />);- const chip = screen.getByText('ada').closest('div') as HTMLElement;+ const chip = screen.getByText('ada').closest('button') as HTMLElement;fireEvent.mouseEnter(chip);expect(chip.className).toContain('text-[#ef4444]');fireEvent.mouseLeave(chip);diff --git a/client/src/components/Planner/PlaceInspector.tsx b/client/src/components/Planner/PlaceInspector.tsxindex ef99b5f47..b3768fafb 100644--- a/client/src/components/Planner/PlaceInspector.tsx+++ b/client/src/components/Planner/PlaceInspector.tsx@@ -484,7 +484,7 @@ export default function PlaceInspector({<StatusBadge status={collectionStatus} onChange={onSetStatus} t={t} />)}{/* Trip mode — day assignment */}- {mode === 'trip' && selectedDayId && (+ {mode === 'trip' && !!selectedDayId && (assignmentInDay ? (<ActionButton onClick={() => onRemoveAssignment?.(selectedDayId, assignmentInDay.id)} variant="ghost" icon={<Minus size={13} />}label={<span className="hidden sm:inline">{t('inspector.removeFromDay')}</span>} />@@ -649,7 +649,7 @@ function ParticipantsBox({ tripMembers, participantIds, allJoined, onSetParticipconst isHovered = hoveredId === member.idconst canRemove = activeMembers.length > 1return (- <div key={member.id}+ <button type="button" key={member.id} disabled={!canRemove}onMouseEnter={() => setHoveredId(member.id)}onMouseLeave={() => setHoveredId(null)}onClick={() => { if (canRemove) handleRemove(member.id) }}@@ -661,15 +661,15 @@ function ParticipantsBox({ tripMembers, participantIds, allJoined, onSetParticipcursor: canRemove ? 'pointer' : 'default',transition: 'all 0.15s',}}>- <div className="bg-surface-tertiary text-content-muted" style={{+ <span className="bg-surface-tertiary text-content-muted" style={{width: 16, height: 16, borderRadius: '50%',display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 'calc(7px * var(--fs-scale-caption, 1))', fontWeight: 700,overflow: 'hidden', flexShrink: 0,}}>- {(member.avatar_url || member.avatar) ? <img src={member.avatar_url || avatarSrc(member.avatar)!} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : member.username?.[0]?.toUpperCase()}- </div>+ {(member.avatar_url || member.avatar) ? <img src={member.avatar_url || avatarSrc(member.avatar)!} alt="" style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : member.username?.[0]?.toUpperCase()}+ </span><span style={{ textDecoration: isHovered && canRemove ? 'line-through' : 'none' }}>{member.username}</span>- </div>+ </button>)})}@@ -706,7 +706,7 @@ function ParticipantsBox({ tripMembers, participantIds, allJoined, onSetParticipdisplay: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 'calc(8px * var(--fs-scale-caption, 1))', fontWeight: 700,overflow: 'hidden', flexShrink: 0,}}>- {(member.avatar_url || member.avatar) ? <img src={member.avatar_url || avatarSrc(member.avatar)!} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : member.username?.[0]?.toUpperCase()}+ {(member.avatar_url || member.avatar) ? <img src={member.avatar_url || avatarSrc(member.avatar)!} alt="" style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : member.username?.[0]?.toUpperCase()}</div><span style={{ flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis' }}>{member.username}</span>{member.is_guest && <GuestBadge size="xs" />}diff --git a/client/src/components/Planner/PlacesBulkCategoryModal.tsx b/client/src/components/Planner/PlacesBulkCategoryModal.tsxindex 70d74a462..facf531a2 100644--- a/client/src/components/Planner/PlacesBulkCategoryModal.tsx+++ b/client/src/components/Planner/PlacesBulkCategoryModal.tsx@@ -28,6 +28,7 @@ export function PlacesBulkCategoryModal({ count, categories, onPick, onClose }:const { t } = useTranslation()return createPortal(<div+ role="presentation"onClick={e => { if (e.target === e.currentTarget) onClose() }}style={{ position: 'fixed', inset: 0, zIndex: 9999, background: 'rgba(0,0,0,0.5)', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}>@@ -53,7 +54,7 @@ export function PlacesBulkCategoryModal({ count, categories, onPick, onClose }:</button>)})}- <button onClick={() => onPick(null)} className="text-content-muted bg-transparent" style={{ ...rowStyle, borderTop: categories.length > 0 ? '1px solid var(--border-faint)' : 'none', marginTop: categories.length > 0 ? 2 : 0 }} onMouseEnter={hoverOn} onMouseLeave={hoverOff}>+ <button type="button" onClick={() => onPick(null)} className="text-content-muted bg-transparent" style={{ ...rowStyle, borderTop: categories.length > 0 ? '1px solid var(--border-faint)' : 'none', marginTop: categories.length > 0 ? 2 : 0 }} onMouseEnter={hoverOn} onMouseLeave={hoverOff}><MapPin size={14} strokeWidth={2} color="var(--text-faint)" /><span style={{ flex: 1 }}>{t('places.noCategory')}</span></button>diff --git a/client/src/components/Planner/PlacesSidebarListImportModal.tsx b/client/src/components/Planner/PlacesSidebarListImportModal.tsxindex 9ab840e43..9582ae162 100644--- a/client/src/components/Planner/PlacesSidebarListImportModal.tsx+++ b/client/src/components/Planner/PlacesSidebarListImportModal.tsx@@ -10,11 +10,13 @@ export function ListImportModal(S: SidebarState) {} = Sreturn createPortal(<div+ role="presentation"onClick={() => { setListImportOpen(false); setListImportUrl('') }}className="bg-[rgba(0,0,0,0.4)]"style={{ position: 'fixed', inset: 0, zIndex: 99999, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}><div+ role="presentation"onClick={e => e.stopPropagation()}className="bg-surface-card"style={{ borderRadius: 16, width: '100%', maxWidth: 440, padding: 24, boxShadow: '0 8px 32px rgba(0,0,0,0.2)' }}diff --git a/client/src/components/Planner/PlacesSidebarMobileDayPicker.tsx b/client/src/components/Planner/PlacesSidebarMobileDayPicker.tsxindex 6ac41c5a1..a63472617 100644--- a/client/src/components/Planner/PlacesSidebarMobileDayPicker.tsx+++ b/client/src/components/Planner/PlacesSidebarMobileDayPicker.tsx@@ -9,10 +9,12 @@ export function MobileDayPickerSheet(S: SidebarState) {} = Sreturn createPortal(<div+ role="presentation"onClick={() => { setDayPickerPlace(null); setMobileShowDays(false) }}style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.4)', zIndex: 99999, display: 'flex', alignItems: 'flex-end', justifyContent: 'center' }}><div+ role="presentation"onClick={e => e.stopPropagation()}className="bg-surface-card"style={{ borderRadius: '20px 20px 0 0', width: '100%', maxWidth: 500, maxHeight: '70vh', display: 'flex', flexDirection: 'column', overflow: 'hidden', paddingBottom: 'var(--bottom-nav-h)' }}diff --git a/client/src/components/Planner/PlacesSidebarRow.tsx b/client/src/components/Planner/PlacesSidebarRow.tsxindex af17f3cfb..2fbf6b278 100644--- a/client/src/components/Planner/PlacesSidebarRow.tsx+++ b/client/src/components/Planner/PlacesSidebarRow.tsx@@ -35,10 +35,22 @@ export const MemoPlaceRow = React.memo(function MemoPlaceRow({const hasGeometry = Boolean(place.route_geometry)// Touch is reached through a long press instead of being locked out (#1616).const dragDisabled = isMobile+ // One place for what a row does, so the keyboard path below cannot drift from the click.+ const activate = () => {+ if (selectMode) {+ toggleSelected(place.id)+ } else if (isMobile) {+ setDayPickerPlace(place)+ } else {+ onPlaceClick(isSelected ? null : place.id)+ }+ }return (<divkey={place.id}ref={element => registerPlaceRow(place.id, element)}+ role="option"+ tabIndex={0}aria-selected={isSelected}data-place-id={place.id}draggable={!selectMode && !dragDisabled}@@ -48,14 +60,11 @@ export const MemoPlaceRow = React.memo(function MemoPlaceRow({e.dataTransfer.effectAllowed = 'copy'window.__dragData = { placeId: String(place.id) }}}- onClick={() => {- if (selectMode) {- toggleSelected(place.id)- } else if (isMobile) {- setDayPickerPlace(place)- } else {- onPlaceClick(isSelected ? null : place.id)- }+ onClick={activate}+ onKeyDown={e => {+ // Only when the row itself has focus — the "+" button inside it keeps its own key handling.+ if (e.target !== e.currentTarget) return+ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); activate() }}}onContextMenu={selectMode ? undefined : e => onContextMenu(e, place)}style={{@@ -120,7 +129,7 @@ export const MemoPlaceRow = React.memo(function MemoPlaceRow({)}</div><div style={{ flexShrink: 0, display: 'flex', alignItems: 'center' }}>- {!selectMode && !inDay && selectedDayId && (+ {!selectMode && !inDay && selectedDayId !== null && (<button type="button"onClick={e => { e.stopPropagation(); onAssignToDay(place.id) }}className="bg-surface-hover text-content-faint"diff --git a/client/src/components/Planner/ReservationModal.test.tsx b/client/src/components/Planner/ReservationModal.test.tsxindex fc9a45dc1..dd7a549b8 100644--- a/client/src/components/Planner/ReservationModal.test.tsx+++ b/client/src/components/Planner/ReservationModal.test.tsx@@ -677,7 +677,8 @@ describe('ReservationModal', () => {// Click the X to unlinkconst fileRow = screen.getByText('receipt.pdf').closest('div')!;- const unlinkBtn = fileRow.querySelector('button[type="button"]')!;+ // Two buttons per row: [0] opens the file, [1] is the unlink X.+ const unlinkBtn = fileRow.querySelectorAll('button[type="button"]')[1];await userEvent.click(unlinkBtn);// File removed from attached list and "Link existing file" button reappears@@ -1317,7 +1318,7 @@ describe('ReservationModal', () => {render(<ReservationModal {...defaultProps} reservation={res} files={[attached]} />);const row = screen.getByText('voucher.pdf').closest('div') as HTMLElement;- await userEvent.click(within(row).getByRole('button'));+ await userEvent.click(within(row).getAllByRole('button')[1]);await waitFor(() => expect(addToast).toHaveBeenCalledWith('Failed to update', 'error', undefined));delete window.__addToast;@@ -1404,14 +1405,14 @@ describe('ReservationModal', () => {});});- it('FE-PLANNER-RESMODAL-086: the open-file link on an attached file does not throw', async () => {+ it('FE-PLANNER-RESMODAL-086: the open-file button on an attached file does not throw', async () => {const res = buildReservation({ id: 16, type: 'other', title: 'Trip' });const attached = buildTripFile({ id: 80, original_name: 'ticket.pdf' });(attached as unknown as { reservation_id: number }).reservation_id = 16;render(<ReservationModal {...defaultProps} reservation={res} files={[attached]} />);const row = screen.getByText('ticket.pdf').closest('div') as HTMLElement;- await userEvent.click(within(row).getByRole('link'));+ await userEvent.click(within(row).getAllByRole('button')[0]);// The download is best-effort; the row must survive a failed fetch.expect(screen.getByText('ticket.pdf')).toBeInTheDocument();});diff --git a/client/src/components/Planner/ReservationModal.tsx b/client/src/components/Planner/ReservationModal.tsxindex c6cab1753..4b550e6e1 100644--- a/client/src/components/Planner/ReservationModal.tsx+++ b/client/src/components/Planner/ReservationModal.tsx@@ -698,7 +698,7 @@ export function ReservationModal({ isOpen, onClose, onSave, reservation, days, p<div key={f.id} className="bg-surface-secondary" style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '5px 10px', borderRadius: 8 }}><FileText size={12} className="text-content-muted" style={{ flexShrink: 0 }} /><span className="text-content-secondary" style={{ flex: 1, fontSize: 'calc(12px * var(--fs-scale-body, 1))', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{f.original_name}</span>- <a href="#" onClick={(e) => { e.preventDefault(); openFile(f.url).catch(() => {}) }} className="text-content-faint" style={{ display: 'flex', flexShrink: 0, cursor: 'pointer' }}><ExternalLink size={11} /></a>+ <button type="button" onClick={() => { openFile(f.url).catch(() => {}) }} className="text-content-faint" style={{ background: 'none', border: 'none', cursor: 'pointer', display: 'flex', padding: 0, flexShrink: 0 }}><ExternalLink size={11} /></button><button type="button" onClick={async () => {if (f.reservation_id === reservation?.id) {try { await apiClient.put(`/trips/${tripId}/files/${f.id}`, { reservation_id: null }) } catch { toast.error(t('reservations.toast.updateError')) }diff --git a/client/src/components/Planner/ReservationsPanel.tsx b/client/src/components/Planner/ReservationsPanel.tsxindex c69d0b79d..edddd24ed 100644--- a/client/src/components/Planner/ReservationsPanel.tsx+++ b/client/src/components/Planner/ReservationsPanel.tsx@@ -77,6 +77,35 @@ function buildAssignmentLookup(days, assignments) {const fieldLabelClass = 'text-[10px] font-semibold uppercase tracking-[0.08em] text-content-faint mb-[5px]'const fieldValueClass = 'text-[13px] font-medium text-content px-[10px] py-[8px] bg-surface-tertiary rounded-[10px]'+// A booking code is only a control while the blur setting is on: then it lifts on+// hover and toggles on click or Enter. With blurring off it is plain text, so it+// stays a plain element instead of a button that can never do anything.+function ConfirmationCode({ code, blurred, revealed, onReveal }: {+ code: React.ReactNode+ blurred: boolean+ revealed: boolean+ onReveal: (next: boolean | ((v: boolean) => boolean)) => void+}) {+ const codeStyle: CSSProperties = {+ fontFamily: '"SF Mono", "JetBrains Mono", Menlo, monospace', fontSize: 'calc(12.5px * var(--fs-scale-body, 1))',+ filter: blurred && !revealed ? 'blur(5px)' : 'none',+ transition: 'filter 0.2s',+ }+ if (!blurred) return <div className={`${fieldValueClass} text-center`} style={{ ...codeStyle, cursor: 'default' }}>{code}</div>+ return (+ <button+ type="button"+ className={`${fieldValueClass} text-center`}+ style={{ ...codeStyle, cursor: 'pointer', width: '100%' }}+ onMouseEnter={() => onReveal(true)}+ onMouseLeave={() => onReveal(false)}+ onClick={() => onReveal(v => !v)}+ >+ {code}+ </button>+ )+}+interface ReservationCardProps {r: ReservationtripId: number@@ -298,20 +327,7 @@ function ReservationCard({ r, tripId, onEdit, onDelete, files = [], onNavigateTo{hasCode && (<div><div className={fieldLabelClass}>{t('reservations.confirmationCode')}</div>- <div- onMouseEnter={() => blurCodes && setCodeRevealed(true)}- onMouseLeave={() => blurCodes && setCodeRevealed(false)}- onClick={() => blurCodes && setCodeRevealed(v => !v)}- className={`${fieldValueClass} text-center`}- style={{- fontFamily: '"SF Mono", "JetBrains Mono", Menlo, monospace', fontSize: 'calc(12.5px * var(--fs-scale-body, 1))',- filter: blurCodes && !codeRevealed ? 'blur(5px)' : 'none',- cursor: blurCodes ? 'pointer' : 'default',- transition: 'filter 0.2s',- }}- >- {r.confirmation_number}- </div>+ <ConfirmationCode code={r.confirmation_number} blurred={!!blurCodes} revealed={codeRevealed} onReveal={setCodeRevealed} /></div>)}@@ -350,20 +366,7 @@ function ReservationCard({ r, tripId, onEdit, onDelete, files = [], onNavigateTo{coded.map((l, i) => (<div key={i}><div className={fieldLabelClass}>{[l.from, l.to].filter(Boolean).join(' → ') || t('reservations.confirmationCode')}</div>- <div- onMouseEnter={() => blurCodes && setCodeRevealed(true)}- onMouseLeave={() => blurCodes && setCodeRevealed(false)}- onClick={() => blurCodes && setCodeRevealed(v => !v)}- className={`${fieldValueClass} text-center`}- style={{- fontFamily: '"SF Mono", "JetBrains Mono", Menlo, monospace', fontSize: 'calc(12.5px * var(--fs-scale-body, 1))',- filter: blurCodes && !codeRevealed ? 'blur(5px)' : 'none',- cursor: blurCodes ? 'pointer' : 'default',- transition: 'filter 0.2s',- }}- >- {l.confirmation_number}- </div>+ <ConfirmationCode code={l.confirmation_number} blurred={!!blurCodes} revealed={codeRevealed} onReveal={setCodeRevealed} /></div>))}</div>@@ -463,10 +466,10 @@ function ReservationCard({ r, tripId, onEdit, onDelete, files = [], onNavigateTo<div className={fieldLabelClass}>{t('files.title')}</div><div className={fieldValueClass} style={{ display: 'flex', flexDirection: 'column', gap: 4, padding: '6px 10px' }}>{attachedFiles.map(f => (- <a key={f.id} href="#" onClick={(e) => { e.preventDefault(); openFile(f.url).catch(() => {}) }} style={{ display: 'flex', alignItems: 'center', gap: 5, textDecoration: 'none', cursor: 'pointer' }}>+ <button key={f.id} type="button" onClick={() => { openFile(f.url).catch(() => {}) }} style={{ display: 'flex', alignItems: 'center', gap: 5, cursor: 'pointer', background: 'none', border: 'none', padding: 0, textAlign: 'left', fontFamily: 'inherit' }}><FileText size={11} className="text-content-faint" style={{ flexShrink: 0 }} /><span style={{ fontSize: 'calc(12px * var(--fs-scale-body, 1))', color: 'var(--text-muted)', flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{f.original_name}</span>- </a>+ </button>))}</div></div>@@ -497,12 +500,12 @@ function ReservationCard({ r, tripId, onEdit, onDelete, files = [], onNavigateTo{/* Delete confirmation */}{showDeleteConfirm && createPortal(- <div className="bg-[rgba(0,0,0,0.3)]" style={{+ <div className="bg-[rgba(0,0,0,0.3)]" role="presentation" style={{position: 'fixed', inset: 0, zIndex: 1000,display: 'flex', alignItems: 'center', justifyContent: 'center',backdropFilter: 'blur(3px)',}} onClick={() => setShowDeleteConfirm(false)}>- <div className="bg-surface-card" style={{+ <div className="bg-surface-card" role="presentation" style={{width: 340, borderRadius: 16,boxShadow: '0 16px 48px rgba(0,0,0,0.22)', padding: '22px 22px 18px',display: 'flex', flexDirection: 'column', gap: 12,@@ -610,6 +613,9 @@ function TransitJourneyCard({ r, days, onOpen, onDelete, canEdit, tripId, contri<divclassName="bg-surface-card"onClick={() => onOpen(r)}+ role="button"+ tabIndex={0}+ onKeyDown={e => { if (e.target === e.currentTarget && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); onOpen(r) } }}style={{ borderRadius: 12, border: '1px solid rgba(124,58,237,0.22)', padding: '12px 14px', display: 'flex', flexDirection: 'column', gap: 9, cursor: 'pointer', transition: 'box-shadow 0.15s ease' }}onMouseEnter={e => e.currentTarget.style.boxShadow = '0 2px 12px rgba(0,0,0,0.06)'}onMouseLeave={e => e.currentTarget.style.boxShadow = 'none'}@@ -658,7 +664,7 @@ function TransitJourneyCard({ r, days, onOpen, onDelete, canEdit, tripId, contri</div>)}{r.travelers && r.travelers.length > 0 && (- <div style={{ paddingLeft: 44 }} onClick={e => e.stopPropagation()}>+ <div style={{ paddingLeft: 44 }} role="presentation" onClick={e => e.stopPropagation()}><TravelerAvatarRow travelers={r.travelers} /></div>)}@@ -666,7 +672,7 @@ function TransitJourneyCard({ r, days, onOpen, onDelete, canEdit, tripId, contri{/* Reservation-detail plugin slots: sandboxed, scoped to this journey. Thecard itself is clickable, so keep frame interactions from opening it. */}{detailPlugins.length > 0 && (- <div onClick={e => e.stopPropagation()} style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>+ <div role="presentation" onClick={e => e.stopPropagation()} style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>{detailPlugins.map(p => (<div key={p.id} className="bg-surface-hover" style={{ borderRadius: 10, overflow: 'hidden' }}><PluginFrame pluginId={p.id} tripId={String(tripId)} reservationId={String(r.id)} title={p.name} surface="detail-slot" />@@ -675,8 +681,8 @@ function TransitJourneyCard({ r, days, onOpen, onDelete, canEdit, tripId, contri</div>)}{confirmOpen && createPortal(- <div className="bg-[rgba(0,0,0,0.35)]" style={{ position: 'fixed', inset: 0, zIndex: 3000, display: 'flex', alignItems: 'center', justifyContent: 'center' }} onClick={e => { e.stopPropagation(); setConfirmOpen(false) }}>- <div className="bg-surface-card" style={{ borderRadius: 14, padding: 20, width: 340, boxShadow: '0 16px 48px rgba(0,0,0,0.22)' }} onClick={e => e.stopPropagation()}>+ <div className="bg-[rgba(0,0,0,0.35)]" role="presentation" style={{ position: 'fixed', inset: 0, zIndex: 3000, display: 'flex', alignItems: 'center', justifyContent: 'center' }} onClick={e => { e.stopPropagation(); setConfirmOpen(false) }}>+ <div className="bg-surface-card" role="presentation" style={{ borderRadius: 14, padding: 20, width: 340, boxShadow: '0 16px 48px rgba(0,0,0,0.22)' }} onClick={e => e.stopPropagation()}><div className="text-content" style={{ fontWeight: 600, fontSize: 'calc(14px * var(--fs-scale-body, 1))', marginBottom: 6 }}>{t('reservations.confirm.deleteTitle')}</div><div className="text-content-muted" style={{ fontSize: 'calc(12.5px * var(--fs-scale-body, 1))', marginBottom: 14 }}>{t('reservations.confirm.deleteBody', { name: r.title })}</div><div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8 }}>@@ -957,13 +963,13 @@ export default function ReservationsPanel({ tripId, reservations, days, assignme{t(addManualKey)}</button>{onImport && bookingImportAvailable && (- <button onClick={onImport} className="bg-surface-card text-content" style={{ ...CTA_STYLE, border: '1px solid var(--border-primary)' }}>+ <button type="button" onClick={onImport} className="bg-surface-card text-content" style={{ ...CTA_STYLE, border: '1px solid var(--border-primary)' }}><Download size={14} strokeWidth={2} />{t('reservations.import.cta')}</button>)}{onAirTrailImport && airTrailAvailable && (- <button onClick={onAirTrailImport} className="bg-surface-secondary text-content" style={{ ...CTA_STYLE, border: '1px solid var(--border-primary)' }}>+ <button type="button" onClick={onAirTrailImport} className="bg-surface-secondary text-content" style={{ ...CTA_STYLE, border: '1px solid var(--border-primary)' }}><Plane size={14} strokeWidth={2} />{t('reservations.airtrail.cta')}</button>diff --git a/client/src/components/Planner/TransitSearchPanel.tsx b/client/src/components/Planner/TransitSearchPanel.tsxindex 100fc4151..981a68f1d 100644--- a/client/src/components/Planner/TransitSearchPanel.tsx+++ b/client/src/components/Planner/TransitSearchPanel.tsx@@ -539,9 +539,9 @@ export default function TransitSearchPanel({ day, days, places, accommodations =)}</div><div className="bg-surface-secondary" style={{ display: 'flex', borderRadius: 9, padding: 3, width: isMobile ? '100%' : undefined }}>- <button onClick={() => setPref('best')} style={{ ...segBtn(pref === 'best'), flex: isMobile ? 1 : undefined }}>{t('transit.pref.best')}</button>- <button onClick={() => setPref('transfers')} style={{ ...segBtn(pref === 'transfers'), flex: isMobile ? 1 : undefined }}>{t('transit.pref.transfers')}</button>- <button onClick={() => setPref('walking')} style={{ ...segBtn(pref === 'walking'), flex: isMobile ? 1 : undefined }}>{t('transit.pref.walking')}</button>+ <button type="button" onClick={() => setPref('best')} style={{ ...segBtn(pref === 'best'), flex: isMobile ? 1 : undefined }}>{t('transit.pref.best')}</button>+ <button type="button" onClick={() => setPref('transfers')} style={{ ...segBtn(pref === 'transfers'), flex: isMobile ? 1 : undefined }}>{t('transit.pref.transfers')}</button>+ <button type="button" onClick={() => setPref('walking')} style={{ ...segBtn(pref === 'walking'), flex: isMobile ? 1 : undefined }}>{t('transit.pref.walking')}</button></div></div>diff --git a/client/src/components/Planner/TransportModal.test.tsx b/client/src/components/Planner/TransportModal.test.tsxindex 45c0b0500..99ee224b5 100644--- a/client/src/components/Planner/TransportModal.test.tsx+++ b/client/src/components/Planner/TransportModal.test.tsx@@ -307,7 +307,8 @@ describe('TransportModal', () => {);const fileRow = screen.getByText('rental-agreement.pdf').closest('div')!;- const unlinkBtn = fileRow.querySelector('button[type="button"]')!;+ // The row carries two buttons: [0] opens the file, [1] unlinks it.+ const unlinkBtn = fileRow.querySelectorAll('button[type="button"]')[1];await userEvent.click(unlinkBtn);await waitFor(() => {@@ -1080,7 +1081,7 @@ describe('TransportModal', () => {render(<TransportModal {...defaultProps} reservation={res} files={[attached]} />);const row = screen.getByText('boarding.pdf').closest('div') as HTMLElement;- await userEvent.click(within(row).getByRole('button'));+ await userEvent.click(within(row).getAllByRole('button')[1]);await waitFor(() => expect(addToast).toHaveBeenCalledWith('Failed to update', 'error', undefined));delete window.__addToast;@@ -1186,7 +1187,7 @@ describe('TransportModal', () => {render(<TransportModal {...defaultProps} reservation={res} files={[attached]} />);const row = screen.getByText('boarding.pdf').closest('div') as HTMLElement;- await userEvent.click(within(row).getByRole('link'));+ await userEvent.click(within(row).getByRole('button', { name: /open/i }));expect(screen.getByText('boarding.pdf')).toBeInTheDocument();});diff --git a/client/src/components/Planner/TransportModal.tsx b/client/src/components/Planner/TransportModal.tsxindex 9e0422185..3f349447f 100644--- a/client/src/components/Planner/TransportModal.tsx+++ b/client/src/components/Planner/TransportModal.tsx@@ -55,11 +55,19 @@ function endpointFromLocation(l: LocationPoint, role: 'from' | 'to' | 'stop', se}}+// "Paris Charles de Gaulle (CDG)" → "Paris Charles de Gaulle". Done as a trim+// plus an anchored test instead of /\s*\([A-Z]{3}\)\s*$/, because the leading+// \s* backtracks over every space in a long name for a quadratic worst case.+function stripAirportCode(name: string): string {+ const trimmed = name.trimEnd()+ return /\([A-Z]{3}\)$/.test(trimmed) ? trimmed.slice(0, -5).trimEnd() : name+}+function airportFromEndpoint(e: ReservationEndpoint | undefined): Airport | null {if (!e || !e.code) return nullreturn {iata: e.code, icao: null,- name: e.name, city: e.name.replace(/\s*\([A-Z]{3}\)\s*$/, ''),+ name: e.name, city: stripAirportCode(e.name),country: '',lat: e.lat, lng: e.lng,tz: e.timezone || '',@@ -1011,7 +1019,7 @@ export function TransportModal({ isOpen, onClose, onSave, reservation, days, sel<div key={f.id} className="bg-surface-secondary" style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '5px 10px', borderRadius: 8 }}><FileText size={12} className="text-content-muted" style={{ flexShrink: 0 }} /><span className="text-content-secondary" style={{ flex: 1, fontSize: 'calc(12px * var(--fs-scale-body, 1))', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{f.original_name}</span>- <a href="#" onClick={(e) => { e.preventDefault(); openFile(f.url).catch(() => {}) }} className="text-content-faint" style={{ display: 'flex', flexShrink: 0, cursor: 'pointer' }}><ExternalLink size={11} /></a>+ <button type="button" onClick={() => { openFile(f.url).catch(() => {}) }} aria-label={t('common.open')} className="text-content-faint" style={{ background: 'none', border: 'none', padding: 0, display: 'flex', flexShrink: 0, cursor: 'pointer' }}><ExternalLink size={11} /></button><button type="button" onClick={async () => {if (f.reservation_id === reservation?.id) {try { await apiClient.put(`/trips/${tripId}/files/${f.id}`, { reservation_id: null }) } catch { toast.error(t('reservations.toast.updateError')) }diff --git a/client/src/components/Planner/placeHoursFormat.ts b/client/src/components/Planner/placeHoursFormat.tsindex e80d1a9db..02f08b8a6 100644--- a/client/src/components/Planner/placeHoursFormat.ts+++ b/client/src/components/Planner/placeHoursFormat.ts@@ -15,10 +15,16 @@ export function convertHoursLine(line: string, timeFormat: string): string {const hasAmPm = /\d{1,2}:\d{2}\s*(AM|PM)/i.test(line)if (timeFormat === '12h' && !hasAmPm) {- // 24h → 12h: "10:00" → "10:00 AM", "21:00" → "9:00 PM", "Uhr" entfernen- return line.replace(/\s*Uhr/g, '').replace(/(\d{1,2}):(\d{2})/g, (match, h, m) => {+ // 24h → 12h: "10:00" → "10:00 AM", "21:00" → "9:00 PM", "Uhr" entfernen.+ // split/trimEnd rather than /\s*Uhr/g: that pattern walks the rest of the line+ // from every space it passes, so a line with no "Uhr" in it costs a pass per+ // space. Cutting on the word and trimming the piece in front of it is the+ // same edit, once.+ const parts = line.split('Uhr')+ const withoutUhr = parts.map((part, i) => (i < parts.length - 1 ? part.trimEnd() : part)).join('')+ return withoutUhr.replace(/(\d{1,2}):(\d{2})/g, (match, h, m) => {const hour = Number.parseInt(h)- if (isNaN(hour)) return match+ if (Number.isNaN(hour)) return matchconst period = hour >= 12 ? 'PM' : 'AM'const h12 = hour === 0 ? 12 : hour > 12 ? hour - 12 : hourreturn `${h12}:${m} ${period}`diff --git a/client/src/components/Plugins/PluginContributions.tsx b/client/src/components/Plugins/PluginContributions.tsxindex a1aafc283..bbc9a1928 100644--- a/client/src/components/Plugins/PluginContributions.tsx+++ b/client/src/components/Plugins/PluginContributions.tsx@@ -108,8 +108,8 @@ export function PluginActions({ items, tripId, className }: { items: ViewContrib</button>))}{frame && (- <div className="fixed inset-0 z-[4000] flex items-center justify-center bg-black/50 p-4" onClick={() => setFrame(null)}>- <div className="bg-surface-card rounded-xl shadow-xl w-full max-w-lg h-[70vh] flex flex-col overflow-hidden" onClick={(e) => e.stopPropagation()}>+ <div role="presentation" className="fixed inset-0 z-[4000] flex items-center justify-center bg-black/50 p-4" onClick={() => setFrame(null)}>+ <div role="presentation" className="bg-surface-card rounded-xl shadow-xl w-full max-w-lg h-[70vh] flex flex-col overflow-hidden" onClick={(e) => e.stopPropagation()}><div className="flex items-center justify-between px-4 py-2.5 border-b border-edge shrink-0"><span className="text-sm font-medium text-content truncate">{frame.label}</span><button type="button" onClick={() => setFrame(null)} className="text-content-muted hover:text-content"><X size={16} /></button>diff --git a/client/src/components/Settings/AccountTab.tsx b/client/src/components/Settings/AccountTab.tsxindex 84798bbb9..126d296d6 100644--- a/client/src/components/Settings/AccountTab.tsx+++ b/client/src/components/Settings/AccountTab.tsx@@ -13,6 +13,14 @@ import PasskeysSection from './PasskeysSection'const MFA_BACKUP_SESSION_KEY = 'trek_mfa_backup_codes_pending'+// Drops every trailing slash, like the `/\/+$/` replace it stands in for — as a scan,+// because that pattern re-walks the slash run from each start position.+const stripTrailingSlashes = (value: string): string => {+ let end = value.length+ while (end > 0 && value[end - 1] === '/') end--+ return value.slice(0, end)+}+export default function AccountTab(): React.ReactElement {const { user, updateProfile, uploadAvatar, deleteAvatar, logout, loadUser, demoMode, appRequireMfa } = useAuthStore()const [searchParams] = useSearchParams()@@ -463,7 +471,7 @@ export default function AccountTab(): React.ReactElement {</div>{(user as UserWithOidc)?.oidc_issuer && (<p className="text-content-faint" style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', marginTop: -2 }}>- {t('settings.oidcLinked')} {(user as UserWithOidc).oidc_issuer!.replace('https://', '').replace(/\/+$/, '')}+ {t('settings.oidcLinked')} {stripTrailingSlashes((user as UserWithOidc).oidc_issuer!.replace('https://', ''))}</p>)}</div>@@ -508,11 +516,11 @@ export default function AccountTab(): React.ReactElement {position: 'fixed', inset: 0, zIndex: 9999,backdropFilter: 'blur(4px)',display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 24,- }} onClick={() => setShowDeleteConfirm(false)}>+ }} role="presentation" onClick={e => { if (e.target === e.currentTarget) setShowDeleteConfirm(false) }}><div className="bg-surface-card" style={{borderRadius: 16, padding: '28px 24px',maxWidth: 400, width: '100%', boxShadow: '0 20px 60px rgba(0,0,0,0.3)',- }} onClick={e => e.stopPropagation()}>+ }}><div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 16 }}><div className="bg-[#fef3c7]" style={{ width: 36, height: 36, borderRadius: 10, display: 'flex', alignItems: 'center', justifyContent: 'center' }}><Shield size={18} className="text-[#d97706]" />@@ -544,11 +552,11 @@ export default function AccountTab(): React.ReactElement {position: 'fixed', inset: 0, zIndex: 9999,backdropFilter: 'blur(4px)',display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 24,- }} onClick={() => setShowDeleteConfirm(false)}>+ }} role="presentation" onClick={e => { if (e.target === e.currentTarget) setShowDeleteConfirm(false) }}><div className="bg-surface-card" style={{borderRadius: 16, padding: '28px 24px',maxWidth: 400, width: '100%', boxShadow: '0 20px 60px rgba(0,0,0,0.3)',- }} onClick={e => e.stopPropagation()}>+ }}><div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 16 }}><div className="bg-[#fef2f2]" style={{ width: 36, height: 36, borderRadius: 10, display: 'flex', alignItems: 'center', justifyContent: 'center' }}><Trash2 size={18} className="text-[#ef4444]" />diff --git a/client/src/components/Settings/AppearanceSettingsTab.tsx b/client/src/components/Settings/AppearanceSettingsTab.tsxindex 95e404aa0..ca53525ba 100644--- a/client/src/components/Settings/AppearanceSettingsTab.tsx+++ b/client/src/components/Settings/AppearanceSettingsTab.tsx@@ -139,7 +139,7 @@ export default function AppearanceSettingsTab(): React.ReactElement {const accentLight = cfg.accent?.light ?? '#4f46e5'const accentDark = cfg.accent?.dark ?? '#6366f1'- const customRatio = contrastRatio(isDark ? accentDark : accentLight, isDark ? '#ffffff' : '#ffffff')+ const customRatio = contrastRatio(isDark ? accentDark : accentLight, '#ffffff')return (<>diff --git a/client/src/components/Settings/IntegrationsTab.tsx b/client/src/components/Settings/IntegrationsTab.tsxindex 9af43a975..b0aaaac38 100644--- a/client/src/components/Settings/IntegrationsTab.tsx+++ b/client/src/components/Settings/IntegrationsTab.tsx@@ -416,6 +416,7 @@ function IntegrationsMcpSection(props: any) {))}{client.allowed_scopes.length > 5 && (<button+ type="button"onClick={() => setOauthScopesExpanded(prev => ({ ...prev, [client.id]: !prev[client.id] }))}className="px-1.5 py-0.5 rounded text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-700 border border-edge"style={{ color: 'var(--text-tertiary)' }}>@@ -549,7 +550,7 @@ function McpTokenModals(props: any) {<>{/* Create MCP Token modal */}{mcpModalOpen && (- <div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"onClick={e => { if (e.target === e.currentTarget && !mcpCreatedToken) setMcpModalOpen(false) }}><div className="rounded-xl shadow-xl w-full max-w-md p-6 space-y-4 bg-surface-card">{!mcpCreatedToken ? (@@ -605,7 +606,7 @@ function McpTokenModals(props: any) {{/* Delete MCP Token confirm */}{mcpDeleteId !== null && (- <div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"onClick={e => { if (e.target === e.currentTarget) setMcpDeleteId(null) }}><div className="rounded-xl shadow-xl w-full max-w-sm p-6 space-y-4 bg-surface-card"><h3 className="text-base font-semibold text-content">{t('settings.mcp.deleteTokenTitle')}</h3>@@ -636,7 +637,7 @@ function OAuthClientModals(props: any) {<>{/* Create OAuth Client modal */}{oauthCreateOpen && (- <div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"onClick={e => { if (e.target === e.currentTarget && !oauthCreatedClient) setOauthCreateOpen(false) }}><div className="rounded-xl shadow-xl w-full max-w-lg p-6 space-y-4 overflow-y-auto max-h-[90vh] bg-surface-card">{!oauthCreatedClient ? (@@ -670,12 +671,12 @@ function OAuthClientModals(props: any) {autoFocus /></div>- <label className="flex items-start gap-2.5 cursor-pointer">- <input type="checkbox" checked={oauthIsMachine} onChange={e => setOauthIsMachine(e.target.checked)}+ <label htmlFor="oauth-machine-client" className="flex items-start gap-2.5 cursor-pointer">+ <input id="oauth-machine-client" type="checkbox" checked={oauthIsMachine} onChange={e => setOauthIsMachine(e.target.checked)}className="mt-0.5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500" />- <div>- <span className="text-sm font-medium text-content-secondary">{t('settings.oauth.modal.machineClient')}</span>- <p className="text-xs mt-0.5" style={{ color: 'var(--text-tertiary)' }}>{t('settings.oauth.modal.machineClientHint')}</p>+ <div className="text-sm font-medium text-content-secondary">+ {t('settings.oauth.modal.machineClient')}+ <p className="text-xs mt-0.5 font-normal" style={{ color: 'var(--text-tertiary)' }}>{t('settings.oauth.modal.machineClientHint')}</p></div></label>@@ -763,7 +764,7 @@ function OAuthClientModals(props: any) {{/* Delete OAuth Client confirm */}{oauthDeleteId !== null && (- <div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"onClick={e => { if (e.target === e.currentTarget) setOauthDeleteId(null) }}><div className="rounded-xl shadow-xl w-full max-w-sm p-6 space-y-4 bg-surface-card"><h3 className="text-base font-semibold text-content">{t('settings.oauth.deleteClient')}</h3>@@ -784,7 +785,7 @@ function OAuthClientModals(props: any) {{/* Rotate OAuth Client Secret confirm */}{oauthRotateId !== null && (- <div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"onClick={e => { if (e.target === e.currentTarget) setOauthRotateId(null) }}><div className="rounded-xl shadow-xl w-full max-w-sm p-6 space-y-4 bg-surface-card"><h3 className="text-base font-semibold text-content">{t('settings.oauth.rotateSecret')}</h3>@@ -836,7 +837,7 @@ function OAuthClientModals(props: any) {{/* Revoke OAuth Session confirm */}{oauthRevokeId !== null && (- <div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"+ <div role="presentation" className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-[rgba(0,0,0,0.5)]"onClick={e => { if (e.target === e.currentTarget) setOauthRevokeId(null) }}><div className="rounded-xl shadow-xl w-full max-w-sm p-6 space-y-4 bg-surface-card"><h3 className="text-base font-semibold text-content">{t('settings.oauth.revokeSession')}</h3>diff --git a/client/src/components/Settings/MapSettingsTab.tsx b/client/src/components/Settings/MapSettingsTab.tsxindex 97e3e599e..1f489e1ea 100644--- a/client/src/components/Settings/MapSettingsTab.tsx+++ b/client/src/components/Settings/MapSettingsTab.tsx@@ -196,7 +196,7 @@ export default function MapSettingsTab(): React.ReactElement {route_geometry: null,place_time: null,end_time: null,- created_at: Date(),+ created_at: String(new Date()),}], [])const saveMapSettings = async (): Promise<void> => {diff --git a/client/src/components/Studio/StudioCanvas.tsx b/client/src/components/Studio/StudioCanvas.tsxindex eaddd692b..72b0aebcb 100644--- a/client/src/components/Studio/StudioCanvas.tsx+++ b/client/src/components/Studio/StudioCanvas.tsx@@ -431,6 +431,7 @@ export function StudioCanvas({</button><span className="st-quickbar-sep" /><button+ type="button"onClick={() => commit(d => ({...d,spreads: d.spreads.map((sp, i) => (i !== spreadIndex ? sp : {diff --git a/client/src/components/Studio/StudioElementsPanel.tsx b/client/src/components/Studio/StudioElementsPanel.tsxindex cd518ace4..de5a868f3 100644--- a/client/src/components/Studio/StudioElementsPanel.tsx+++ b/client/src/components/Studio/StudioElementsPanel.tsx@@ -352,6 +352,7 @@ export function StudioElementsPanel({ page, t }: { page: BookPageSetup; t: (k: s<div className="st-grid-grid">{GRIDS.map(grid => (<button+ type="button"key={grid.id}className="st-grid-btn"onClick={() => {diff --git a/client/src/components/Studio/StudioSidebar.tsx b/client/src/components/Studio/StudioSidebar.tsxindex 6f58ebfe6..f852046b1 100644--- a/client/src/components/Studio/StudioSidebar.tsx+++ b/client/src/components/Studio/StudioSidebar.tsx@@ -612,6 +612,7 @@ function TemplatesPanel({const slots = tpl.build(page)return (<button+ type="button"key={tpl.id}className="st-thumb"onClick={() => {diff --git a/client/src/components/Studio/StudioSwatches.tsx b/client/src/components/Studio/StudioSwatches.tsxindex 0dd60c0f2..9be276802 100644--- a/client/src/components/Studio/StudioSwatches.tsx+++ b/client/src/components/Studio/StudioSwatches.tsx@@ -30,7 +30,8 @@ export function Swatches({ value, onPick }: { value: string; onPick: (c: string)))}{/* Anything at all, for a book that has to match a cover or a brand. */}<label className="st-swatch st-swatch-custom">- <input type="color" value={value} onChange={e => onPick(e.target.value)} />+ {/* Named by the colour it holds, the way the preset swatches above are. */}+ <input type="color" aria-label={value} value={value} onChange={e => onPick(e.target.value)} /></label></div>)diff --git a/client/src/components/SystemNotices/ReleaseNoticeModal.tsx b/client/src/components/SystemNotices/ReleaseNoticeModal.tsxindex 244dd920d..c87074c4b 100644--- a/client/src/components/SystemNotices/ReleaseNoticeModal.tsx+++ b/client/src/components/SystemNotices/ReleaseNoticeModal.tsx@@ -41,7 +41,7 @@ export function ReleaseNoticeModal({ notice, visible, onDismiss, onCTA, onSecondclassName="rn-overlay"role="presentation"style={{ opacity: visible ? 1 : 0, transition: 'opacity 260ms ease' }}- onClick={notice.dismissible ? onDismiss : undefined}+ onClick={notice.dismissible ? e => { if (e.target === e.currentTarget) onDismiss() } : undefined}><divrole="dialog"@@ -49,7 +49,6 @@ export function ReleaseNoticeModal({ notice, visible, onDismiss, onCTA, onSecondaria-labelledby={titleId}aria-describedby={bodyId}className="rn-panel"- onClick={e => e.stopPropagation()}>{/* ── Left: the release ─────────────────────────────────────────── */}<div className="rn-release">diff --git a/client/src/components/SystemNotices/SystemNoticeModal.test.tsx b/client/src/components/SystemNotices/SystemNoticeModal.test.tsxindex 63822b13d..05a68b6fa 100644--- a/client/src/components/SystemNotices/SystemNoticeModal.test.tsx+++ b/client/src/components/SystemNotices/SystemNoticeModal.test.tsx@@ -1084,7 +1084,7 @@ describe('ModalRenderer', () => {render(<ModalRenderer notices={[noticeA, noticeB]} />);await flushGraceDelay();- const backdrop = screen.getByRole('presentation').children[1] as HTMLElement;+ const backdrop = screen.getAllByRole('presentation')[1] as HTMLElement;await act(async () => {fireEvent.click(backdrop);});@@ -1113,7 +1113,7 @@ describe('ModalRenderer', () => {expect(screen.getByRole('dialog').className).toContain('opacity-100');await act(async () => {- fireEvent.click(screen.getByRole('presentation').children[1] as HTMLElement);+ fireEvent.click(screen.getAllByRole('presentation')[1] as HTMLElement);});expect(dismissSpy).toHaveBeenCalledWith('n-a');@@ -1326,7 +1326,7 @@ describe('ModalRenderer', () => {await flushGraceDelay();await act(async () => {- fireEvent.click(screen.getByRole('presentation').children[1] as HTMLElement);+ fireEvent.click(screen.getAllByRole('presentation')[1] as HTMLElement);});expect(dismissSpy).not.toHaveBeenCalled();diff --git a/client/src/components/SystemNotices/SystemNoticeModal.tsx b/client/src/components/SystemNotices/SystemNoticeModal.tsxindex ca501e361..7565b62d6 100644--- a/client/src/components/SystemNotices/SystemNoticeModal.tsx+++ b/client/src/components/SystemNotices/SystemNoticeModal.tsx@@ -676,6 +676,7 @@ function MobileNoticeSheet(S: NoticeState) {{/* Backdrop */}<divclassName={`absolute inset-0 bg-slate-950/40 backdrop-blur-[2px] transition-opacity ${dur} ${ease} ${visible ? 'opacity-100' : 'opacity-0'}`}+ role="presentation"onClick={notice.dismissible ? animatedDismissAll : undefined}/>{/* Bottom sheet */}@@ -843,18 +844,22 @@ function DesktopNoticeModal(S: NoticeState) {<divclassName={`fixed inset-0 z-50 bg-slate-950/40 backdrop-blur-[2px] transition-opacity ${dur} ${ease} ${visible ? 'opacity-100' : 'opacity-0'}`}role="presentation"- onClick={notice.dismissible && isLastPage ? handleDismissAll : undefined}>{/* Screen-reader page announcements */}<span className="sr-only" role="status" aria-live="polite" aria-atomic="true">{pageAnnouncement}</span>- <div className="absolute inset-0 flex items-center justify-center p-4">+ {/* The dismiss lives on this layer: it covers the backdrop, and the+ target check keeps a click inside the panel from closing the notice. */}+ <div+ className="absolute inset-0 flex items-center justify-center p-4"+ role="presentation"+ onClick={notice.dismissible && isLastPage ? (e => { if (e.target === e.currentTarget) handleDismissAll() }) : undefined}+ ><divrole="dialog"aria-modal="true"aria-labelledby={titleId}aria-describedby={bodyId}className={`w-full ${maxWidth} rounded-2xl overflow-hidden overflow-y-auto max-h-[90vh] shadow-xl border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 transition-all ${dur} ${ease} ${desktopMotion}`}- onClick={e => e.stopPropagation()}><div ref={contentWrapperRef}><NoticeContent {...makeContentProps(S, notice, idx)} />diff --git a/client/src/components/Todo/TodoListPanel.test.tsx b/client/src/components/Todo/TodoListPanel.test.tsxindex 5940024e8..06bf2aa7b 100644--- a/client/src/components/Todo/TodoListPanel.test.tsx+++ b/client/src/components/Todo/TodoListPanel.test.tsx@@ -132,24 +132,20 @@ describe('TodoListPanel', () => {const user = userEvent.setup();let putCalled = false;server.use(- http.put('/api/trips/1/todo/:id/toggle', () => {+ http.put('/api/trips/1/todo/:id', () => {putCalled = true;return HttpResponse.json({ success: true });}));const items = [buildTodoItem({ id: 5, name: 'Toggle Me', checked: 0 })];render(<TodoListPanel tripId={1} items={items} />);- // Click the checkbox button (Square icon)- const checkboxes = screen.getAllByRole('button');- // Find the checkbox button near the item- const checkboxBtn = checkboxes.find(btn => {- const parent = btn.closest('[style*="cursor: pointer"]');- return parent && parent.textContent?.includes('Toggle Me');- });- if (checkboxBtn) {- await user.click(checkboxBtn);- await waitFor(() => expect(putCalled).toBe(true));- }+ // The checkbox is the row's own <button>; the row around it is a button role.+ const row = screen.getByText('Toggle Me').closest('[role="button"]') as HTMLElement;+ const checkboxBtn = row.querySelector('button') as HTMLElement;++ await user.click(checkboxBtn);++ await waitFor(() => expect(putCalled).toBe(true));});it('FE-COMP-TODO-013: clicking a task row opens its detail pane', async () => {@@ -180,7 +176,7 @@ describe('TodoListPanel', () => {expect(screen.getByText('JobTask')).toBeInTheDocument();expect(screen.getByText('HomeTask')).toBeInTheDocument();// Category buttons exist in sidebar (by accessible name or text)- const catBtn = screen.getByRole('button', { name: /JobCat/ });+ const catBtn = sidebarButton(/JobCat/);expect(catBtn).toBeInTheDocument();// Clicking the category button should work without throwingawait user.click(catBtn);@@ -467,9 +463,19 @@ function pickOption(label: string | RegExp) {* The sidebar filters are an inline component, so every re-render (the members* fetch resolving, for one) swaps the button element. userEvent's async steps can* land on the detached node — fireEvent stays atomic.+ *+ * A task row is a button too (it is what selects the task), and its name is built+ * from everything it shows, category chip included. So the sidebar entry is picked+ * by being an actual <button>.*/+function sidebarButton(name: RegExp | string): HTMLElement {+ const [button] = screen.getAllByRole('button', { name }).filter(el => el.tagName === 'BUTTON');+ expect(button).toBeDefined();+ return button;+}+function clickFilter(name: RegExp | string) {- fireEvent.click(screen.getByRole('button', { name }));+ fireEvent.click(sidebarButton(name));}describe('TodoListPanel — sidebar', () => {diff --git a/client/src/components/Todo/TodoListPanel.tsx b/client/src/components/Todo/TodoListPanel.tsxindex f02a8f54e..5a4e04301 100644--- a/client/src/components/Todo/TodoListPanel.tsx+++ b/client/src/components/Todo/TodoListPanel.tsx@@ -267,7 +267,7 @@ export default function TodoListPanel({ tripId, items, addItemSignal = 0 }: { tr/>)}{selectedItem && !isAddingNew && isMobile && (- <div onClick={e => { if (e.target === e.currentTarget) setSelectedId(null) }}+ <div role="presentation" onClick={e => { if (e.target === e.currentTarget) setSelectedId(null) }}style={{ position: 'fixed', inset: 0, zIndex: 1000, background: 'rgba(0,0,0,0.4)', display: 'flex', justifyContent: 'center', alignItems: 'flex-end', paddingBottom: 'var(--bottom-nav-h)' }}><div style={{ width: '100%', maxHeight: '85vh', borderRadius: '16px 16px 0 0', overflow: 'auto' }}ref={el => { if (el) { const child = el.firstElementChild as HTMLElement; if (child) { child.style.width = '100%'; child.style.borderLeft = 'none'; child.style.borderRadius = '16px 16px 0 0' } } }}>@@ -282,7 +282,7 @@ export default function TodoListPanel({ tripId, items, addItemSignal = 0 }: { tr</div>)}{isAddingNew && !selectedItem && !isMobile && createPortal(- <div onClick={e => { if (e.target === e.currentTarget) setIsAddingNew(false) }}+ <div role="presentation" onClick={e => { if (e.target === e.currentTarget) setIsAddingNew(false) }}className="trek-modal-backdrop"style={{ position: 'fixed', inset: 0, zIndex: 1000, background: 'rgba(15,23,42,0.5)', display: 'flex', justifyContent: 'center', alignItems: 'flex-start', paddingTop: 'calc(var(--nav-h) + 60px)', paddingBottom: 40 }}><div style={{ width: 'min(520px, 92vw)', maxHeight: 'calc(100vh - var(--nav-h) - 120px)', overflow: 'auto', borderRadius: 16, boxShadow: '0 20px 60px rgba(0,0,0,0.25)' }}@@ -300,7 +300,7 @@ export default function TodoListPanel({ tripId, items, addItemSignal = 0 }: { trdocument.body)}{isAddingNew && !selectedItem && isMobile && createPortal(- <div onClick={e => { if (e.target === e.currentTarget) setIsAddingNew(false) }}+ <div role="presentation" onClick={e => { if (e.target === e.currentTarget) setIsAddingNew(false) }}className="trek-modal-backdrop"style={{ position: 'fixed', inset: 0, zIndex: 1000, background: 'rgba(0,0,0,0.4)', display: 'flex', justifyContent: 'center', alignItems: 'flex-end', paddingBottom: 'var(--bottom-nav-h)' }}><div style={{ width: '100%', maxHeight: '85vh', borderRadius: '16px 16px 0 0', overflow: 'auto' }}diff --git a/client/src/components/Todo/TodoRow.test.tsx b/client/src/components/Todo/TodoRow.test.tsxindex f1d9501a1..ab686c882 100644--- a/client/src/components/Todo/TodoRow.test.tsx+++ b/client/src/components/Todo/TodoRow.test.tsx@@ -73,26 +73,26 @@ describe('TodoRow', () => {})it('FE-W4TDR-004: the checkbox toggles the task without selecting the row', () => {- const { onToggle, onSelect } = setup(todo())+ const { onToggle, onSelect, container } = setup(todo())- fireEvent.click(screen.getAllByRole('button')[0])+ fireEvent.click(container.querySelector('button')!)expect(onToggle).toHaveBeenCalledWith(10, true)expect(onSelect).not.toHaveBeenCalled()})it('FE-W4TDR-005: a done task strikes through and unchecks on click', () => {- const { onToggle } = setup(todo({ checked: 1 } as Partial<TodoItem>))+ const { onToggle, container } = setup(todo({ checked: 1 } as Partial<TodoItem>))expect(screen.getByText('Book ferry')).toHaveStyle({ textDecoration: 'line-through' })- fireEvent.click(screen.getAllByRole('button')[0])+ fireEvent.click(container.querySelector('button')!)expect(onToggle).toHaveBeenCalledWith(10, false)})it('FE-W4TDR-006: a read-only row swallows the toggle', () => {- const { onToggle } = setup(todo(), { canEdit: false })+ const { onToggle, container } = setup(todo(), { canEdit: false })- fireEvent.click(screen.getAllByRole('button')[0])+ fireEvent.click(container.querySelector('button')!)expect(onToggle).not.toHaveBeenCalled()})diff --git a/client/src/components/Todo/TodoRow.tsx b/client/src/components/Todo/TodoRow.tsxindex 1e8907b2a..f300eec9b 100644--- a/client/src/components/Todo/TodoRow.tsx+++ b/client/src/components/Todo/TodoRow.tsx@@ -33,7 +33,18 @@ export default function TodoRow({ item, members, categories, today, isSelected,return (<div key={item.id}+ // Selecting the task has no other trigger, so the row is the control. Its+ // checkbox and its drag handle answer for themselves, hence the key handler+ // only fires when the row itself has focus.+ role="button"+ tabIndex={0}onClick={() => onSelect(isSelected ? null : item.id)}+ onKeyDown={e => {+ if (e.target !== e.currentTarget) return+ if (e.key !== 'Enter' && e.key !== ' ') return+ e.preventDefault()+ onSelect(isSelected ? null : item.id)+ }}onDragOver={canDrag ? (e => { e.preventDefault(); e.dataTransfer.dropEffect = 'move'; drag!.onOver(item.id) }) : undefined}onDragLeave={canDrag ? (e => { if (!e.currentTarget.contains(e.relatedTarget as Node)) drag!.onOver(-1) }) : undefined}onDrop={canDrag ? (e => { e.preventDefault(); e.stopPropagation(); drag!.onDrop(item.id) }) : undefined}@@ -50,6 +61,9 @@ export default function TodoRow({ item, members, categories, today, isSelected,{canDrag && (<div+ // Dragging is the handle's whole job; the click only keeps the row from+ // selecting, so the handle stays presentational.+ role="presentation"draggableonClick={e => e.stopPropagation()}onDragStart={e => { e.stopPropagation(); e.dataTransfer.effectAllowed = 'move'; drag!.onStart(item.id) }}@@ -83,7 +97,7 @@ export default function TodoRow({ item, members, categories, today, isSelected,</div>)}{/* Inline badges */}- {(item.priority || item.due_date || catColor || assignedUser) && (+ {!!(item.priority || item.due_date || catColor || assignedUser) && (<div style={{ display: 'flex', gap: 5, marginTop: 5, flexWrap: 'wrap' }}>{item.priority > 0 && PRIO_CONFIG[item.priority] && (<span style={{diff --git a/client/src/components/Todo/todoListModel.ts b/client/src/components/Todo/todoListModel.tsindex 3961fa180..702789915 100644--- a/client/src/components/Todo/todoListModel.ts+++ b/client/src/components/Todo/todoListModel.ts@@ -15,7 +15,7 @@ export function katColor(kat: string, allCategories: string[]) {const idx = allCategories.indexOf(kat)if (idx >= 0) return KAT_COLORS[idx % KAT_COLORS.length]let h = 0- for (let i = 0; i < kat.length; i++) h = ((h << 5) - h + kat.charCodeAt(i)) | 0+ for (let i = 0; i < kat.length; i++) h = ((h << 5) - h + kat.codePointAt(i)) | 0return KAT_COLORS[Math.abs(h) % KAT_COLORS.length]}diff --git a/client/src/components/Trips/TripFormModal.test.tsx b/client/src/components/Trips/TripFormModal.test.tsxindex b144809fb..a75f301fc 100644--- a/client/src/components/Trips/TripFormModal.test.tsx+++ b/client/src/components/Trips/TripFormModal.test.tsx@@ -1,6 +1,6 @@// FE-COMP-TRIPFORM-001 to FE-COMP-TRIPFORM-084import type { Mock } from 'vitest';-import { render, screen, waitFor, fireEvent } from '../../../tests/helpers/render';+import { render, screen, waitFor, fireEvent, within } from '../../../tests/helpers/render';import userEvent from '@testing-library/user-event';import { delay, http, HttpResponse } from 'msw';import { useAuthStore } from '../../store/authStore';@@ -272,7 +272,7 @@ describe('TripFormModal', () => {const aliceChip = screen.getByText('alice');expect(aliceChip).toBeInTheDocument();// Click the chip to remove alice- await user.click(aliceChip.closest('span')!);+ await user.click(aliceChip.closest('button')!);// alice chip should be goneawait waitFor(() => expect(screen.queryByText('alice')).not.toBeInTheDocument());});@@ -1071,9 +1071,11 @@ describe('TripFormModal', () => {await screen.findByText('alice');await user.click(screen.getByText('Add member').closest('button')!);- // alice is already a member, so only bob is offered.- expect(screen.queryAllByRole('button', { name: 'alice' })).toHaveLength(0);- await user.click(await screen.findByRole('button', { name: 'bob' }));+ // alice is already a member, so the option list offers only bob (her chip+ // outside the list is a button of its own — that is what removes her).+ const bobOption = await screen.findByRole('button', { name: 'bob' });+ expect(within(bobOption.parentElement!).queryByRole('button', { name: 'alice' })).toBeNull();+ await user.click(bobOption);await waitFor(() => expect(identifier).toBe('bob'));expect(addToast).toHaveBeenCalledWith('bob added', 'success', undefined);diff --git a/client/src/components/Trips/TripFormModal.tsx b/client/src/components/Trips/TripFormModal.tsxindex 0d000d23e..228e97d76 100644--- a/client/src/components/Trips/TripFormModal.tsx+++ b/client/src/components/Trips/TripFormModal.tsx@@ -384,7 +384,7 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUp<button type="button" onClick={() => setPendingDateShift(null)} disabled={isLoading} className={ghostBtnCls}>{t('common.back')}</button>- <button onClick={() => performSave({ ...pendingDateShift, date_shift_mode: dateShiftMode })} disabled={isLoading}+ <button type="button" onClick={() => performSave({ ...pendingDateShift, date_shift_mode: dateShiftMode })} disabled={isLoading}className={primaryBtnCls}>{isLoading? <><div className="w-4 h-4 border-2 border-accent-text/30 border-t-accent-text rounded-full animate-spin" />{t('common.saving')}</>@@ -420,9 +420,9 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUpclassName={`flex items-start gap-3 p-3 border rounded-xl cursor-pointer transition-colors ${dateShiftMode === mode ? 'border-accent bg-surface-selected' : 'border-edge hover:bg-surface-hover'}`}><input type="radio" name="date_shift_mode" value={mode} checked={dateShiftMode === mode}onChange={() => setDateShiftMode(mode)} className="mt-1 accent-[var(--accent)]" />- <span>- <span className="block text-body font-medium text-content">{label}</span>- <span className="block text-body text-content-muted mt-0.5">{desc}</span>+ <span className="block text-body font-medium text-content">+ {label}+ <span className="block text-body font-normal text-content-muted mt-0.5">{desc}</span></span></label>))}@@ -633,13 +633,13 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUp{allUsers.filter(u => u.id !== currentUser?.id).length > 0 && (<div><label className={labelCls}>- <UserPlus className="w-3.5 h-3.5" />{isEditing ? t('dashboard.addMembers') : t('dashboard.addMembers')}+ <UserPlus className="w-3.5 h-3.5" />{t('dashboard.addMembers')}</label>{/* Existing members (editing mode) */}{isEditing && existingMembers.length > 0 && (<div className="flex flex-wrap gap-1.5 mb-2">{existingMembers.map(m => (- <span key={m.id}+ <button type="button" key={m.id} disabled={m.id === currentUser?.id}className="flex items-center gap-1.5 px-2.5 py-1 rounded-full text-body font-medium bg-surface text-content border border-edge"onClick={async () => {if (m.id === currentUser?.id) return@@ -652,7 +652,7 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUpstyle={{ cursor: m.id === currentUser?.id ? 'default' : 'pointer' }}>{m.username}{m.id !== currentUser?.id && <X size={11} className="text-content-faint" />}- </span>+ </button>))}</div>)}@@ -662,11 +662,11 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUp{selectedMembers.map(uid => {const user = allUsers.find(u => u.id === uid)!return (- <span key={uid} onClick={() => setSelectedMembers(prev => prev.filter(id => id !== uid))}+ <button type="button" key={uid} onClick={() => setSelectedMembers(prev => prev.filter(id => id !== uid))}className="flex items-center gap-1.5 px-2.5 py-1 rounded-full text-body font-medium bg-surface text-content border border-edge cursor-pointer">{user.username}<X size={11} className="text-content-faint" />- </span>+ </button>)})}</div>diff --git a/client/src/components/Trips/TripMembersModal.tsx b/client/src/components/Trips/TripMembersModal.tsxindex 85c570a4d..dcc768c19 100644--- a/client/src/components/Trips/TripMembersModal.tsx+++ b/client/src/components/Trips/TripMembersModal.tsx@@ -23,7 +23,7 @@ function Avatar({ username, avatarUrl, size = 32 }: AvatarProps) {}const letter = (username || '?')[0].toUpperCase()const colors = ['#3b82f6', '#8b5cf6', '#ec4899', '#10b981', '#f59e0b', '#ef4444', '#06b6d4']- const color = colors[letter.charCodeAt(0) % colors.length]+ const color = colors[(letter.codePointAt(0) ?? 0) % colors.length]return (<div style={{width: size, height: size, borderRadius: '50%', background: color,diff --git a/client/src/components/Vacay/VacayMonthCard.tsx b/client/src/components/Vacay/VacayMonthCard.tsxindex 6b80eeddf..7dc1d0d44 100644--- a/client/src/components/Vacay/VacayMonthCard.tsx+++ b/client/src/components/Vacay/VacayMonthCard.tsx@@ -161,6 +161,10 @@ export default function VacayMonthCard({<divkey={di}title={publicHoliday ? (publicHoliday.label ? `${publicHoliday.label}: ${publicHoliday.localName}` : publicHoliday.localName) : undefined}+ // Stays a div: the cell is a grid item that stacks the segment,+ // ring and marker overlays on top of itself.+ role="button"+ tabIndex={0}className="relative flex items-center justify-center transition-colors"style={{height: 28,@@ -170,6 +174,7 @@ export default function VacayMonthCard({cursor: isBlocked ? 'default' : 'pointer',}}onClick={() => onCellClick(dateStr)}+ onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onCellClick(dateStr) } }}onMouseEnter={e => {if (!isBlocked && plain) e.currentTarget.style.background = 'var(--vg-surf2)'if (hasEntries || sharedColors.length > 0 || schoolHolidayMarkers.length > 0) onCellHover?.(dateStr, e.currentTarget)diff --git a/client/src/components/Vacay/VacayPersons.tsx b/client/src/components/Vacay/VacayPersons.tsxindex 86bb4788d..080452aac 100644--- a/client/src/components/Vacay/VacayPersons.tsx+++ b/client/src/components/Vacay/VacayPersons.tsx@@ -1,5 +1,5 @@import { createPortal } from 'react-dom'-import { useState, useEffect } from 'react'+import { useState, useEffect, type HTMLAttributes } from 'react'import { UserPlus, Check, Loader2, Clock, X } from 'lucide-react'import { useVacayStore } from '../../store/vacayStore'import { useAuthStore } from '../../store/authStore'@@ -77,9 +77,20 @@ export default function VacayPersons() {<div className="flex flex-col gap-1">{users.map(u => {const isSelected = selectedUserId === u.id+ // Only a fused plan lets you pick whose leave you are looking at, so the+ // row takes focus and keys only then — it stays a div because the colour+ // dot inside it is a button of its own.+ const select: HTMLAttributes<HTMLDivElement> = isFused+ ? {+ role: 'button',+ tabIndex: 0,+ onClick: () => setSelectedUserId(u.id),+ onKeyDown: e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setSelectedUserId(u.id) } },+ }+ : {}return (<div key={u.id}- onClick={() => { if (isFused) setSelectedUserId(u.id) }}+ {...select}className="flex items-center gap-2.5 group transition-colors"style={{padding: '7px 10px',@@ -126,9 +137,9 @@ export default function VacayPersons() {{/* Invite Modal — Portal to body to avoid z-index issues */}{showInvite && createPortal(<div className="fixed inset-0 flex items-center justify-center px-4 trek-backdrop-enter bg-[rgba(15,23,42,0.5)]" style={{ zIndex: 99990, paddingTop: 70 }}- onClick={() => setShowInvite(false)}>- <div className="trek-modal-enter rounded-2xl shadow-2xl w-full max-w-sm bg-surface-card"- onClick={e => e.stopPropagation()}>+ role="presentation"+ onClick={e => { if (e.target === e.currentTarget) setShowInvite(false) }}>+ <div className="trek-modal-enter rounded-2xl shadow-2xl w-full max-w-sm bg-surface-card"><div className="flex items-center justify-between p-5 border-b border-edge-secondary"><h2 className="text-base font-semibold text-content">{t('vacay.inviteUser')}</h2><button type="button" onClick={() => setShowInvite(false)} className="p-1.5 rounded-lg transition-colors text-content-faint">@@ -167,9 +178,9 @@ export default function VacayPersons() {{/* Color Picker Modal — Portal to body */}{showColorPicker && createPortal(<div className="fixed inset-0 flex items-center justify-center px-4 trek-backdrop-enter bg-[rgba(15,23,42,0.5)]" style={{ zIndex: 99990, paddingTop: 70 }}- onClick={() => { setShowColorPicker(false); setColorEditUserId(null) }}>- <div className="trek-modal-enter rounded-2xl shadow-2xl w-full max-w-xs bg-surface-card"- onClick={e => e.stopPropagation()}>+ role="presentation"+ onClick={e => { if (e.target !== e.currentTarget) return; setShowColorPicker(false); setColorEditUserId(null) }}>+ <div className="trek-modal-enter rounded-2xl shadow-2xl w-full max-w-xs bg-surface-card"><div className="flex items-center justify-between p-5 border-b border-edge-secondary"><h2 className="text-base font-semibold text-content">{t('vacay.changeColor')}</h2><button type="button" onClick={() => { setShowColorPicker(false); setColorEditUserId(null) }} className="p-1.5 rounded-lg transition-colors text-content-faint">diff --git a/client/src/components/Vacay/VacaySettings.tsx b/client/src/components/Vacay/VacaySettings.tsxindex fd59f5176..62cda3490 100644--- a/client/src/components/Vacay/VacaySettings.tsx+++ b/client/src/components/Vacay/VacaySettings.tsx@@ -345,7 +345,7 @@ function YearTypePicker() {{ value: 'fiscal', label: t('vacay.yearTypeFiscal') },{ value: 'anniversary', label: t('vacay.yearTypeAnniversary') },] as const).map(({ value, label }) => (- <button key={value} onClick={() => save({ year_type: value })}+ <button type="button" key={value} onClick={() => save({ year_type: value })}style={{padding: '4px 10px', borderRadius: 8, fontSize: 'calc(12px * var(--fs-scale-body, 1))', fontWeight: 600, cursor: 'pointer',fontFamily: 'inherit', border: '1px solid', transition: 'all 0.12s',diff --git a/client/src/components/Vacay/VacaySharedCalendars.tsx b/client/src/components/Vacay/VacaySharedCalendars.tsxindex 59d903f8b..2a2dfa059 100644--- a/client/src/components/Vacay/VacaySharedCalendars.tsx+++ b/client/src/components/Vacay/VacaySharedCalendars.tsx@@ -77,7 +77,10 @@ export default function VacaySharedCalendars() {<div className="flex flex-col gap-1">{incomingShares.map(s => (<div key={s.id}+ role="button"+ tabIndex={0}onClick={() => handleToggleHidden(s.id, !s.hidden)}+ onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); handleToggleHidden(s.id, !s.hidden) } }}className="flex items-center gap-2.5 group transition-colors cursor-pointer"style={{ padding: '7px 10px', borderRadius: 12, opacity: s.hidden ? 0.55 : 1 }}title={s.hidden ? t('vacay.showInCalendar') : t('vacay.hideFromCalendar')}>@@ -128,8 +131,10 @@ export default function VacaySharedCalendars() {{/* Share Modal — Portal to body to avoid z-index issues */}{showShare && createPortal(<div className="fixed inset-0 flex items-center justify-center px-4 trek-backdrop-enter bg-[rgba(15,23,42,0.5)]" style={{ zIndex: 99990, paddingTop: 70 }}+ role="presentation"onClick={() => setShowShare(false)}><div className="trek-modal-enter rounded-2xl shadow-2xl w-full max-w-sm bg-surface-card"+ role="presentation"onClick={e => e.stopPropagation()}><div className="flex items-center justify-between p-5 border-b border-edge-secondary"><h2 className="text-base font-semibold text-content">{t('vacay.shareCalendar')}</h2>diff --git a/client/src/components/Vacay/VacayStats.tsx b/client/src/components/Vacay/VacayStats.tsxindex 136ac1c41..7a6c51a0b 100644--- a/client/src/components/Vacay/VacayStats.tsx+++ b/client/src/components/Vacay/VacayStats.tsx@@ -117,7 +117,7 @@ function StatCard({ stat: s, isMe, canEdit, selectedYear, isShiftedYear, onSave,const handleSave = () => {setEditing(false)const days = Number.parseInt(String(localDays))- if (!isNaN(days) && days >= 0 && days <= 365 && days !== s.vacation_days) {+ if (!Number.isNaN(days) && days >= 0 && days <= 365 && days !== s.vacation_days) {onSave(selectedYear, days, s.user_id)}}@@ -159,6 +159,9 @@ function StatCard({ stat: s, isMe, canEdit, selectedYear, isShiftedYear, onSave,className="group/days"style={{ padding: '6px 9px', borderRadius: 10, background: 'var(--vg-surf2)', cursor: canEdit ? 'pointer' : 'default' }}onClick={() => { if (canEdit && !editing) setEditing(true) }}+ role={canEdit && !editing ? 'button' : undefined}+ tabIndex={canEdit && !editing ? 0 : undefined}+ onKeyDown={canEdit && !editing ? e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setEditing(true) } } : undefined}><div style={{ fontSize: 10, marginBottom: 2, color: 'var(--vg-ink3)', height: 13, lineHeight: '13px' }}>{t('vacay.entitlementDays')} {canEdit && !editing && <Pencil size={9} className="inline opacity-0 group-hover/days:opacity-100 transition-opacity" style={{ verticalAlign: 'middle', color: 'var(--vg-ink3)' }} />}diff --git a/client/src/components/shared/ConfirmDialog.tsx b/client/src/components/shared/ConfirmDialog.tsxindex c2adb84bc..472ca5cf9 100644--- a/client/src/components/shared/ConfirmDialog.tsx+++ b/client/src/components/shared/ConfirmDialog.tsx@@ -51,11 +51,15 @@ export default function ConfirmDialog({return createPortal(<div+ // Backdrop only — Escape (above) and the Cancel button below are the+ // keyboard routes out of the dialog.+ role="presentation"className="fixed inset-0 z-[10000] flex items-center justify-center px-4 trek-backdrop-enter bg-[rgba(15,23,42,0.5)]"style={{ paddingBottom: 'var(--bottom-nav-h)' }}onClick={onClose}><div+ role="presentation"className="trek-modal-enter rounded-2xl shadow-2xl w-full max-w-sm p-6 bg-surface-card"onClick={e => e.stopPropagation()}>diff --git a/client/src/components/shared/CopyTripDialog.tsx b/client/src/components/shared/CopyTripDialog.tsxindex a97810e59..d22343c93 100644--- a/client/src/components/shared/CopyTripDialog.tsx+++ b/client/src/components/shared/CopyTripDialog.tsx@@ -44,9 +44,17 @@ export default function CopyTripDialog({ isOpen, tripTitle, onClose, onConfirm }<divclassName="fixed inset-0 z-[10000] flex items-center justify-center px-4 trek-backdrop-enter bg-[rgba(15,23,42,0.5)]"style={{ paddingBottom: 'var(--bottom-nav-h)' }}+ role="button"+ tabIndex={0}+ aria-label={t('common.close')}onClick={onClose}+ onKeyDown={e => {+ if (e.target !== e.currentTarget) return+ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onClose() }+ }}><div+ role="presentation"className="trek-modal-enter rounded-2xl shadow-2xl w-full max-w-md p-6 bg-surface-card"onClick={e => e.stopPropagation()}>diff --git a/client/src/components/shared/CustomDateTimePicker.tsx b/client/src/components/shared/CustomDateTimePicker.tsxindex bfaf285d5..e0497fbe5 100644--- a/client/src/components/shared/CustomDateTimePicker.tsx+++ b/client/src/components/shared/CustomDateTimePicker.tsx@@ -231,7 +231,7 @@ export function CustomDatePicker({let d = get('day'),m = get('month');const y = get('year');- if (isNaN(d) || isNaN(m) || isNaN(y)) return;+ if (Number.isNaN(d) || Number.isNaN(m) || Number.isNaN(y)) return;// If locale order gives impossible month but valid swap, correct itif (m > 12 && d <= 12) {diff --git a/client/src/components/shared/CustomTimePicker.tsx b/client/src/components/shared/CustomTimePicker.tsxindex e1a21f7e5..6658bbaf2 100644--- a/client/src/components/shared/CustomTimePicker.tsx+++ b/client/src/components/shared/CustomTimePicker.tsx@@ -21,9 +21,11 @@ export default function CustomTimePicker({ value, onChange, placeholder = '00:00// The spinner is short, and it has to keep up with a scrolling sheet (#1999).const anchored = useAnchoredPosition(ref, open, { estimatedHeight: 120, matchWidth: false })- const [h, m] = (parseMeridiemTime(value) ?? value ?? '').split(':').map(Number)- const hour = isNaN(h) ? null : h- const minute = isNaN(m) ? null : m+ // `m` falls back to NaN because a value with no colon ('' while the field is+ // empty) splits into a single part, and an absent minute has to read as unset.+ const [h, m = NaN] = (parseMeridiemTime(value) ?? value ?? '').split(':').map(Number)+ const hour = Number.isNaN(h) ? null : h+ const minute = Number.isNaN(m) ? null : museEffect(() => {const handler = (e: MouseEvent) => {diff --git a/client/src/components/shared/Modal.tsx b/client/src/components/shared/Modal.tsxindex 53b51eb49..9a26a19cc 100644--- a/client/src/components/shared/Modal.tsx+++ b/client/src/components/shared/Modal.tsx@@ -59,6 +59,10 @@ export default function Modal({return createPortal(<div+ // Backdrop and panel are plain boxes: the backdrop only catches the+ // click-away, the panel only keeps that click from reaching it. Escape+ // and the header's close button are the keyboard route out.+ role="presentation"className="fixed inset-0 z-[10000] flex items-start sm:items-center justify-center px-4 trek-modal-backdrop trek-backdrop-enter bg-[rgba(15,23,42,0.5)]"style={{ paddingTop: 70, paddingBottom: 'calc(20px + var(--bottom-nav-h))', overflow: 'hidden' }}onMouseDown={e => { mouseDownTarget.current = e.target }}@@ -68,6 +72,7 @@ export default function Modal({}}><div+ role="presentation"className={`trek-modal-enterrounded-2xl overflow-hidden shadow-2xl w-full ${sizeClasses[size] || sizeClasses.md}diff --git a/client/src/components/shared/StarRating.tsx b/client/src/components/shared/StarRating.tsxindex d66e9b56b..dc59e31ea 100644--- a/client/src/components/shared/StarRating.tsx+++ b/client/src/components/shared/StarRating.tsx@@ -119,7 +119,7 @@ export default function PlaceRating({ ratings, ratingAvg, onRate, size = 16, comfontSize: 'calc(8px * var(--fs-scale-caption, 1))', fontWeight: 700,marginLeft: i ? -5 : 0, border: '1.5px solid var(--bg-elevated, #fff)',}}>- {r.avatar ? <img src={avatarSrc(r.avatar)!} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : r.username?.[0]?.toUpperCase()}+ {r.avatar ? <img src={avatarSrc(r.avatar)!} alt={r.username || ''} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : r.username?.[0]?.toUpperCase()}</span>))}</span>diff --git a/client/src/hooks/useGeolocation.ts b/client/src/hooks/useGeolocation.tsindex 671a1f404..54ee184ea 100644--- a/client/src/hooks/useGeolocation.ts+++ b/client/src/hooks/useGeolocation.ts@@ -56,8 +56,10 @@ export class GeoOnceError extends Error {// Unlike the watch below, a cached fix up to a minute old is fine here —// the user is standing where they're journaling — so maximumAge is// generous to make the button feel instant when the OS already has a fix.+const ONCE_OPTIONS: PositionOptions = { enableHighAccuracy: true, timeout: 15000, maximumAge: 60000 }+export function getCurrentPositionOnce(- options: PositionOptions = { enableHighAccuracy: true, timeout: 15000, maximumAge: 60000 },+ options: PositionOptions = ONCE_OPTIONS,): Promise<GeoPosition> {return new Promise((resolve, reject) => {if (!('geolocation' in navigator)) {diff --git a/client/src/mobile/components/MBottomNav.tsx b/client/src/mobile/components/MBottomNav.tsxindex 48e96c86f..43da5b782 100644--- a/client/src/mobile/components/MBottomNav.tsx+++ b/client/src/mobile/components/MBottomNav.tsx@@ -136,9 +136,10 @@ export default function MBottomNav() {<>{moreOpen && (// Invisible scrim (the popover sits on the UI without dimming it).- <div className="fixed inset-0 z-[60]" onClick={() => setMoreOpen(false)}>+ <div className="fixed inset-0 z-[60]" role="presentation" onClick={() => setMoreOpen(false)}><divclassName="absolute left-4 right-4 flex flex-col gap-2 rounded-[26px] border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] p-[10px] shadow-[0_-8px_40px_-14px_rgba(0,0,0,.45)] backdrop-blur-[30px] backdrop-saturate-[1.8] bottom-[calc(env(safe-area-inset-bottom,0px)+86px)]"+ role="presentation"onClick={e => e.stopPropagation()}>{moreItems.map(({ to, label, icon: Icon }) => (diff --git a/client/src/mobile/components/MDropdownPanel.tsx b/client/src/mobile/components/MDropdownPanel.tsxindex 8adb8a44b..5987c0843 100644--- a/client/src/mobile/components/MDropdownPanel.tsx+++ b/client/src/mobile/components/MDropdownPanel.tsx@@ -19,7 +19,9 @@ export default function MDropdownPanel({ open, onClose, className = '', childrenreturn (<>- <div className="fixed inset-0 z-[35]" onClick={onClose} />+ {/* Invisible dismiss layer — decoration to a reader, which is why it carries+ no role of its own; the panel's own controls are the keyboard path. */}+ <div className="fixed inset-0 z-[35]" role="presentation" onClick={onClose} /><divclassName={`m-pop-in fixed z-[36] w-[228px] rounded-[20px] border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] p-[6px] text-m-ink shadow-[0_24px_60px_-20px_rgba(0,0,0,.5)] backdrop-blur-[30px] backdrop-saturate-[1.8] ${className}`}>diff --git a/client/src/mobile/components/MSheet.tsx b/client/src/mobile/components/MSheet.tsxindex 915601ff2..08d575756 100644--- a/client/src/mobile/components/MSheet.tsx+++ b/client/src/mobile/components/MSheet.tsx@@ -181,6 +181,7 @@ export default function MSheet({// backdrop-blur (the "liquid glass" frost). The sheet still slides via m-sheet-in.<divclassName={`m-root fixed inset-0 z-[60] ${dimTransparent ? 'bg-transparent' : `bg-[color:var(--m-dim)] ${open ? 'm-fade-in' : 'm-fade-out'}`}`}+ role="presentation"onClick={(e) => {if (e.target === e.currentTarget) onClose()}}diff --git a/client/src/mobile/components/MToastHost.tsx b/client/src/mobile/components/MToastHost.tsxindex 231ed6931..4992f8ba3 100644--- a/client/src/mobile/components/MToastHost.tsx+++ b/client/src/mobile/components/MToastHost.tsx@@ -77,7 +77,10 @@ export default function MToastHost() {return (<divkey={toast.id}+ role={toast.sticky ? 'button' : undefined}+ tabIndex={toast.sticky ? 0 : undefined}onClick={toast.sticky ? () => dismissToast(toast.id) : undefined}+ onKeyDown={toast.sticky ? (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); dismissToast(toast.id) } } : undefined}className={`flex max-w-full items-center gap-2 rounded-full bg-m-act px-4 py-2 text-[0.75rem] font-semibold text-m-actfg shadow-[0_10px_30px_-8px_rgba(0,0,0,.5)] ${toast.sticky ? 'pointer-events-auto cursor-pointer' : ''} ${toast.removing ? 'm-toast-out' : 'm-toast-in'}`}diff --git a/client/src/mobile/screens/admin/MAdminPackingTemplateManager.tsx b/client/src/mobile/screens/admin/MAdminPackingTemplateManager.tsxindex 6b352827c..406f26da7 100644--- a/client/src/mobile/screens/admin/MAdminPackingTemplateManager.tsx+++ b/client/src/mobile/screens/admin/MAdminPackingTemplateManager.tsx@@ -258,12 +258,12 @@ export default function MAdminPackingTemplateManager() {/></div>) : (- <div className="min-w-0 flex-1" onClick={() => toggleExpand(tmpl.id)}>+ <button type="button" className="min-w-0 flex-1 text-left" onClick={() => toggleExpand(tmpl.id)}><div className="truncate text-[0.8125rem] font-bold text-m-ink">{tmpl.name}</div><div className="mt-[1px] font-geist text-[0.59375rem] text-m-faint">{tmpl.category_count} {t('admin.packingTemplates.categories')} · {tmpl.item_count} {t('admin.packingTemplates.items')}</div>- </div>+ </button>)}<PkIconBtnariaLabel={t('common.edit')}diff --git a/client/src/mobile/screens/admin/MAdminPluginsPanel.tsx b/client/src/mobile/screens/admin/MAdminPluginsPanel.tsxindex 41d173d71..7b9a4aaea 100644--- a/client/src/mobile/screens/admin/MAdminPluginsPanel.tsx+++ b/client/src/mobile/screens/admin/MAdminPluginsPanel.tsx@@ -1653,7 +1653,7 @@ function PluginDetailSheet({ item, installed, busy, onInstall, onClose, t, local<h4 className={sectionH}>{t('admin.plugins.detailsTitle')}</h4><div className="mt-2.5 grid grid-cols-2 gap-x-6 gap-y-3">{item.latest && <Meta k={t('admin.plugins.metaVersion')} v={`v${item.latest}`} />}- {sizeKb && <Meta k={t('admin.plugins.metaSize')} v={`${sizeKb} KB`} />}+ {sizeKb !== null && <Meta k={t('admin.plugins.metaSize')} v={`${sizeKb} KB`} />}{/* The range, not just its lower bound: "TREK 3.2.0+" reads as "and anythingnewer", which is exactly the claim a `<4.0.0` upper bound denies. */}{(item.trek || item.minTrekVersion) && (diff --git a/client/src/mobile/screens/atlas/MAtlasSearch.tsx b/client/src/mobile/screens/atlas/MAtlasSearch.tsxindex 703e7700c..34bfc0a49 100644--- a/client/src/mobile/screens/atlas/MAtlasSearch.tsx+++ b/client/src/mobile/screens/atlas/MAtlasSearch.tsx@@ -53,8 +53,18 @@ export default function MAtlasSearch({const scrimCls = 'm-fade-in fixed inset-0 z-[70] flex flex-col bg-[rgba(16,16,19,.28)] px-[18px] pt-[calc(var(--m-safe-top,12px)+12px)] backdrop-blur-[22px] backdrop-saturate-[1.6]' // theme-lint-disable — fixed scrim value from the designreturn (- <div className={scrimCls} onClick={onClose}>- <div className="flex items-center gap-[10px]" onClick={(e) => e.stopPropagation()}>+ <div+ className={scrimCls}+ // presentation, not role="button": the scrim wraps the whole search+ // overlay, so making it a button puts a full-screen tab stop around its+ // own contents — and screen readers would read the entire panel as the+ // button's label. Clicking it is a mouse shortcut for the Cancel control+ // inside, which is already in the tab order. Same treatment as the other+ // backdrops in this sweep.+ role="presentation"+ onClick={onClose}+ >+ <div className="flex items-center gap-[10px]" role="presentation" onClick={(e) => e.stopPropagation()}><label className="flex min-w-0 flex-1 items-center gap-[10px] rounded-[18px] border border-[color:var(--m-gbr)] bg-[color:var(--m-sheetop)] px-4 py-[14px] shadow-[0_12px_30px_-14px_rgba(0,0,0,.4)]"><Search size={18} strokeWidth={2.2} className="flex-none text-m-muted" /><input@@ -77,6 +87,7 @@ export default function MAtlasSearch({{rows.length > 0 && (<divclassName="m-pop-in mt-[14px] divide-y divide-[color:var(--m-rowbr)] overflow-hidden rounded-[20px] border border-[color:var(--m-gbr)] bg-[color:var(--m-sheetop)] shadow-[0_20px_44px_-18px_rgba(0,0,0,.4)]"+ role="presentation"onClick={(e) => e.stopPropagation()}>{rows.map((r) => (diff --git a/client/src/mobile/screens/collections/MCollLabelsSheet.tsx b/client/src/mobile/screens/collections/MCollLabelsSheet.tsxindex ecb94e73c..9be1bbc84 100644--- a/client/src/mobile/screens/collections/MCollLabelsSheet.tsx+++ b/client/src/mobile/screens/collections/MCollLabelsSheet.tsx@@ -152,7 +152,14 @@ export default function MCollLabelsSheet({className={`mb-1 flex items-center gap-[10px] rounded-[13px] px-3 py-[10px] ${editingId === label.id || on ? 'bg-[color:var(--m-ic)]' : ''}`}style={on ? { boxShadow: `inset 0 0 0 1.5px ${col}` } : undefined}onClick={mode === 'assign' ? () => toggleChecked(label.id) : undefined}+ onKeyDown={mode === 'assign'+ ? (e) => {+ if (e.target !== e.currentTarget) return+ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleChecked(label.id) }+ }+ : undefined}role={mode === 'assign' ? 'checkbox' : undefined}+ tabIndex={mode === 'assign' ? 0 : undefined}aria-checked={mode === 'assign' ? on : undefined}><span className="h-[9px] w-[9px] flex-none rounded-full" style={{ background: col }} />diff --git a/client/src/mobile/screens/dashboard/MDashWidgets.tsx b/client/src/mobile/screens/dashboard/MDashWidgets.tsxindex c845472fb..b45513e37 100644--- a/client/src/mobile/screens/dashboard/MDashWidgets.tsx+++ b/client/src/mobile/screens/dashboard/MDashWidgets.tsx@@ -405,7 +405,7 @@ function MUpcomingWidget({ items }: { items: UpcomingReservation[] }): React.Reaconst parsed = splitReservationDateTime(r.reservation_time)const datePart = parsed.date || r.day_date || nullconst date = datePart ? new Date(datePart + 'T00:00:00Z') : null- const dateStr = date && !isNaN(date.getTime())+ const dateStr = date && !Number.isNaN(date.getTime())? date.toLocaleDateString(locale, { day: 'numeric', month: 'short', timeZone: 'UTC' }): nullconst timeStr = parsed.time ? formatTime(parsed.time, locale, timeFormat) : nulldiff --git a/client/src/mobile/screens/dashboard/MDashboard.tsx b/client/src/mobile/screens/dashboard/MDashboard.tsxindex 1fa2c3a2b..d30cad247 100644--- a/client/src/mobile/screens/dashboard/MDashboard.tsx+++ b/client/src/mobile/screens/dashboard/MDashboard.tsx@@ -32,7 +32,7 @@ import type { MobileDashToken } from '@trek/shared'function fullDate(dateStr: string | null | undefined, locale: string): string | null {if (!dateStr) return nullconst date = new Date(dateStr + 'T00:00:00Z')- if (isNaN(date.getTime())) return null+ if (Number.isNaN(date.getTime())) return nullconst opts: Intl.DateTimeFormatOptions = { day: 'numeric', month: 'short', timeZone: 'UTC' }if (date.getUTCFullYear() !== new Date().getUTCFullYear()) opts.year = 'numeric'return date.toLocaleDateString(locale, opts)diff --git a/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx b/client/src/mobile/screens/journey/MJourneySettingsSheet.tsxindex f68398743..5d0ba1279 100644--- a/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx+++ b/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx@@ -140,7 +140,8 @@ export default function MJourneySettingsSheet({const toggleSharePerm = async (key: 'share_timeline' | 'share_gallery' | 'share_map') => {if (!shareLink) return- const updated = { ...shareLink, [key]: !shareLink[key] }+ const previous = shareLink+ const updated = { ...previous, [key]: !previous[key] }setShareLink(updated)try {await journeyApi.createShareLink(journey.id, {@@ -149,7 +150,7 @@ export default function MJourneySettingsSheet({share_map: updated.share_map,})} catch {- setShareLink(shareLink)+ setShareLink(previous)toast.error(t('journey.share.updateFailed'))}}diff --git a/client/src/mobile/screens/notifications/MNotificationRow.tsx b/client/src/mobile/screens/notifications/MNotificationRow.tsxindex edb573ce1..41e4a13ec 100644--- a/client/src/mobile/screens/notifications/MNotificationRow.tsx+++ b/client/src/mobile/screens/notifications/MNotificationRow.tsx@@ -1,4 +1,4 @@-import { useState } from 'react'+import { useState, type HTMLAttributes } from 'react'import { useNavigate } from 'react-router'import { ArrowRight, Bell, Check, Trash2, X } from 'lucide-react'import { useTranslation } from '../../../i18n'@@ -45,10 +45,22 @@ export default function MNotificationRow({ notification }: MNotificationRowPropsif (notification.navigate_target) navigate(notification.navigate_target)}+ // Tapping an unread row marks it read; a row that is already read carries no+ // action, so it neither takes focus nor claims a role. It stays a div because+ // the chips and the delete button inside it are buttons of their own.+ const markReadOnRow: HTMLAttributes<HTMLDivElement> = notification.is_read+ ? {}+ : {+ role: 'button',+ tabIndex: 0,+ onClick: () => markRead(notification.id),+ onKeyDown: e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); markRead(notification.id) } },+ }+return (<divclassName="flex items-start gap-[11px] border-b border-[color:var(--m-rowbr)] py-3 last:border-b-0"- onClick={() => { if (!notification.is_read) markRead(notification.id) }}+ {...markReadOnRow}>{notification.sender_avatar ? (<img src={notification.sender_avatar} alt="" className="h-8 w-8 flex-none rounded-full object-cover" />@@ -65,7 +77,7 @@ export default function MNotificationRow({ notification }: MNotificationRowProps<p className="mt-[2px] font-geist text-[0.65625rem] leading-relaxed text-m-muted">{body}</p>{notification.type === 'boolean' && notification.positive_text_key && notification.negative_text_key && (- <div className="mt-2 flex gap-[6px]" onClick={e => e.stopPropagation()}>+ <div className="mt-2 flex gap-[6px]" role="presentation" onClick={e => e.stopPropagation()}><MChipactive={notification.response === 'positive'}onClick={() => handleRespond('positive')}@@ -86,7 +98,7 @@ export default function MNotificationRow({ notification }: MNotificationRowProps)}{notification.type === 'navigate' && notification.navigate_text_key && notification.navigate_target && (- <div className="mt-2" onClick={e => e.stopPropagation()}>+ <div className="mt-2" role="presentation" onClick={e => e.stopPropagation()}><MChip onClick={handleNavigate}><ArrowRight size={12} strokeWidth={2.2} />{t(notification.navigate_text_key)}diff --git a/client/src/mobile/screens/settings/MSettingsAccount.tsx b/client/src/mobile/screens/settings/MSettingsAccount.tsxindex f1137a268..caa559e66 100644--- a/client/src/mobile/screens/settings/MSettingsAccount.tsx+++ b/client/src/mobile/screens/settings/MSettingsAccount.tsx@@ -44,6 +44,13 @@ function isWebauthnAbort(err: unknown): boolean {return name === 'NotAllowedError' || name === 'AbortError'}+/** Drop trailing slashes for display, as a scan: without it /\/+$/ backtracks quadratically. */+function trimTrailingSlashes(value: string): string {+ let end = value.length+ while (end > 0 && value[end - 1] === '/') end--+ return value.slice(0, end)+}+/*** "Account" section — AccountTab parity: profile + avatar, password change,* TOTP 2FA (setup, backup codes, disable), passkeys and account deletion.@@ -323,7 +330,7 @@ export default function MSettingsAccount() {</div>{oidcIssuer && (<div className="mt-[2px] font-geist text-[0.625rem] text-m-faint">- {t('settings.oidcLinked')} {oidcIssuer.replace('https://', '').replace(/\/+$/, '')}+ {t('settings.oidcLinked')} {trimTrailingSlashes(oidcIssuer.replace('https://', ''))}</div>)}</div>diff --git a/client/src/mobile/screens/settings/MSettingsMap.tsx b/client/src/mobile/screens/settings/MSettingsMap.tsxindex 0a8682056..ad918188e 100644--- a/client/src/mobile/screens/settings/MSettingsMap.tsx+++ b/client/src/mobile/screens/settings/MSettingsMap.tsx@@ -102,7 +102,7 @@ export default function MSettingsMap() {route_geometry: null,place_time: null,end_time: null,- created_at: Date(),+ created_at: String(new Date()),},],[],diff --git a/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx b/client/src/mobile/screens/trip/plan/MPlanTimeline.tsxindex dc053838b..4f026ea70 100644--- a/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx+++ b/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx@@ -250,9 +250,10 @@ function UpNextCard({ tl, t, onOpen }: {const sub = place?.address || place?.description || ''return (- <div+ <button+ type="button"onClick={() => onOpen(upNext.assignment)}- className="absolute left-4 right-4 cursor-pointer rounded-[22px] border border-[color:var(--m-inbr)] bg-[color:var(--m-inner)] px-4 py-3.5 shadow-[0_18px_44px_-18px_rgba(0,0,0,.3)] backdrop-blur-[28px] backdrop-saturate-[1.8] top-[calc(var(--m-safe-top,12px)+102px)]"+ className="absolute left-4 right-4 cursor-pointer rounded-[22px] border border-[color:var(--m-inbr)] bg-[color:var(--m-inner)] px-4 py-3.5 text-left shadow-[0_18px_44px_-18px_rgba(0,0,0,.3)] backdrop-blur-[28px] backdrop-saturate-[1.8] top-[calc(var(--m-safe-top,12px)+102px)]"><div className="flex items-center justify-between"><span className="whitespace-nowrap font-geist text-[0.65625rem] font-bold uppercase tracking-[.08em] text-m-muted">@@ -280,7 +281,7 @@ function UpNextCard({ tl, t, onOpen }: {<ChevronRight size={16} strokeWidth={2.4} /></span></div>- </div>+ </button>)}diff --git a/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx b/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsxindex 2dd33cc3e..180c7046b 100644--- a/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx+++ b/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx@@ -142,7 +142,18 @@ export function PlaceRow({ assignment, fullPlace, linkedRes, chrome, reorder, dr: place?.address || place?.description || ''return (- <div {...dragProps(drag)} onClick={onOpen} className={`flex cursor-pointer items-center gap-2.5 py-1.5 ${dragClass(drag)}`}>+ // Stays a div: in editing mode the row carries its own action circles and+ // reorder controls, which may not be nested inside a <button>. The key+ // handler is guarded on currentTarget so Enter/Space on one of those+ // controls does not also open the row — a mouse click would not either.+ <div+ {...dragProps(drag)}+ role="button"+ tabIndex={0}+ onClick={onOpen}+ onKeyDown={e => { if (e.target === e.currentTarget && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); onOpen() } }}+ className={`flex cursor-pointer items-center gap-2.5 py-1.5 ${dragClass(drag)}`}+ >{!chrome.editing && (<AvatarRing className="shadow-[0_3px_8px_-3px_rgba(0,0,0,.4)]"><PlaceAvatar@@ -213,7 +224,14 @@ export function TransportRow({ res, dayId, chrome, reorder, drag, onOpen }: {const sub = transportSubtitle(res)return (- <div {...dragProps(drag)} onClick={onOpen} className={`mt-1.5 flex cursor-pointer items-center gap-2.5 ${dragClass(drag)}`}>+ <div+ {...dragProps(drag)}+ role="button"+ tabIndex={0}+ onClick={onOpen}+ onKeyDown={e => { if (e.target === e.currentTarget && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); onOpen() } }}+ className={`mt-1.5 flex cursor-pointer items-center gap-2.5 ${dragClass(drag)}`}+ >{!chrome.editing && (<AvatarRing><Icon size={14} strokeWidth={2} />@@ -360,7 +378,14 @@ export function TransitRow({ res, transit, dayId, open, chrome, reorder, drag, o</AvatarRing>)}<div className="min-w-0 flex-1 overflow-hidden rounded-[14px] border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)]">- <div onClick={onToggle} className="cursor-pointer px-3 py-[9px]">+ <div+ role="button"+ tabIndex={0}+ aria-expanded={open}+ onClick={onToggle}+ onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onToggle() } }}+ className="cursor-pointer px-3 py-[9px]"+ ><div className="flex items-center gap-[7px]"><span className="min-w-0 truncate text-[0.84375rem] font-bold">{to ? `${from} → ${to}` : res.title}@@ -498,7 +523,10 @@ export function NoteRow({ note, chrome, reorder, drag, onEdit }: {return (<div{...dragProps(drag)}+ role={chrome.editing ? 'button' : undefined}+ tabIndex={chrome.editing ? 0 : undefined}onClick={chrome.editing ? onEdit : undefined}+ onKeyDown={chrome.editing ? (e => { if (e.target === e.currentTarget && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); onEdit() } }) : undefined}className={`my-[2px] flex items-center gap-2.5 ${chrome.editing ? 'cursor-pointer' : ''} ${dragClass(drag)}`}>{!chrome.editing && (diff --git a/client/src/mobile/screens/trip/sheets/MPlaceEditSheet.tsx b/client/src/mobile/screens/trip/sheets/MPlaceEditSheet.tsxindex 51c5aa24a..bc549e7f4 100644--- a/client/src/mobile/screens/trip/sheets/MPlaceEditSheet.tsx+++ b/client/src/mobile/screens/trip/sheets/MPlaceEditSheet.tsx@@ -187,7 +187,10 @@ export default function MPlaceEditSheet({ planner, onOpenExpense }: MPlaceEditShconst handleCoordPaste = (e: ClipboardEvent<HTMLInputElement>) => {const text = e.clipboardData.getData('text').trim()- const match = text.match(/^(-?\d+\.?\d*)\s*[,;\s]\s*(-?\d+\.?\d*)$/)+ // Same grammar as before, spelled without the overlapping quantifiers pasted text+ // could make backtrack: the separator is either a comma/semicolon with optional+ // padding or pure whitespace, and a decimal is digits with an optional ".digits".+ const match = text.match(/^(-?\d+(?:\.\d*)?)(?:\s*[,;]\s*|\s+)(-?\d+(?:\.\d*)?)$/)if (match) {e.preventDefault()setForm(prev => ({ ...prev, lat: match[1], lng: match[2] }))diff --git a/client/src/mobile/screens/trip/sheets/MPlaceSheet.tsx b/client/src/mobile/screens/trip/sheets/MPlaceSheet.tsxindex f42764967..264851027 100644--- a/client/src/mobile/screens/trip/sheets/MPlaceSheet.tsx+++ b/client/src/mobile/screens/trip/sheets/MPlaceSheet.tsx@@ -513,8 +513,14 @@ export default function MPlaceSheet({ planner, shell }: MTripSheetsProps) {{/* ── Files ── */}<div className={`mt-3 rounded-[13px] px-3 py-[9px] ${INNER_CLS}`}><div+ // Stays a div: the row carries the upload button, which may not+ // nest inside another button.+ role="button"+ tabIndex={0}+ aria-expanded={filesExpanded}className="flex items-center gap-2"onClick={() => { if (placeFiles.length > 0) setFilesExpanded(v => !v) }}+ onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); if (placeFiles.length > 0) setFilesExpanded(v => !v) } }}><Paperclip size={14} strokeWidth={2} className="flex-none text-m-muted" /><span className="min-w-0 flex-1 truncate text-[0.78125rem] font-semibold">diff --git a/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx b/client/src/mobile/screens/trip/sheets/MTransportSheet.tsxindex dc3665ffd..4f0526a46 100644--- a/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx+++ b/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx@@ -218,12 +218,13 @@ export default function MTransportSheet({ planner, shell }: MTripSheetsProps) {{confirmed ? t('reservations.confirmed') : t('reservations.pending')}</span>{res.confirmation_number && (- <span+ <button+ type="button"onClick={() => { if (blurCodes) setCodeRevealed(v => !v) }}className={`flex-none font-geist text-[0.71875rem] tabular-nums text-m-muted ${codeBlurred ? 'blur-[4px] select-none' : ''}`}>#{res.confirmation_number}- </span>+ </button>)}</div>@@ -235,12 +236,13 @@ export default function MTransportSheet({ planner, shell }: MTripSheetsProps) {<span className="min-w-0 flex-1 truncate text-[0.71875rem] font-medium">{[leg.from, leg.to].filter(Boolean).join(' → ') || t('reservations.confirmationCode')}</span>- <span+ <button+ type="button"onClick={() => { if (blurCodes) setCodeRevealed(v => !v) }}className={`flex-none font-geist text-[0.71875rem] tabular-nums text-m-muted ${codeBlurred ? 'blur-[4px] select-none' : ''}`}>#{leg.confirmation_number}- </span>+ </button></div>))}</div>diff --git a/client/src/mobile/screens/trip/sheets/MTripSheetUi.tsx b/client/src/mobile/screens/trip/sheets/MTripSheetUi.tsxindex 6ce637da2..6a6313899 100644--- a/client/src/mobile/screens/trip/sheets/MTripSheetUi.tsx+++ b/client/src/mobile/screens/trip/sheets/MTripSheetUi.tsx@@ -66,18 +66,24 @@ interface StatBoxProps {/** Small stat box (check-in / times / code): value 700 tabular over a faint Geist label. */export function StatBox({ value, label, blurred = false, onClick }: StatBoxProps) {- return (- <div- onClick={onClick}- className="min-w-0 flex-1 rounded-[10px] bg-[color:var(--m-ic)] px-[9px] py-[7px] text-center"- >+ const box = 'min-w-0 flex-1 rounded-[10px] bg-[color:var(--m-ic)] px-[9px] py-[7px] text-center'+ const inner = (+ <><divclassName={`truncate text-[0.8125rem] font-bold tabular-nums leading-tight ${blurred ? 'blur-[4px] select-none' : ''}`}>{value}</div><div className="truncate font-geist text-[0.5625rem] text-m-faint">{label}</div>- </div>+ </>+ )+ // A tappable stat is a real button — value and label give it its name. Without+ // a handler it stays a plain box rather than an empty stop in the tab order.+ if (!onClick) return <div className={box}>{inner}</div>+ return (+ <button type="button" onClick={onClick} className={`${box} block border-0`}>+ {inner}+ </button>)}diff --git a/client/src/mobile/screens/trip/sheets/PlPlaceSearch.tsx b/client/src/mobile/screens/trip/sheets/PlPlaceSearch.tsxindex 2467e987f..28da858a4 100644--- a/client/src/mobile/screens/trip/sheets/PlPlaceSearch.tsx+++ b/client/src/mobile/screens/trip/sheets/PlPlaceSearch.tsx@@ -38,7 +38,7 @@ interface PlPlaceSearchProps {}/** "48.8566, 2.3522" (also ; or whitespace separated) → direct coordinates. */-const COORD_RE = /^(-?\d+\.?\d*)\s*[,;\s]\s*(-?\d+\.?\d*)$/+const COORD_RE = /^(-?\d+(?:\.\d*)?)(?:\s*[,;]\s*|\s+)(-?\d+(?:\.\d*)?)$/function placeToPick(place: MapsPlace): PlSearchPick {const s = (v: unknown) => (v == null ? undefined : String(v))diff --git a/client/src/mobile/screens/trip/tabs/MBookingsTab.tsx b/client/src/mobile/screens/trip/tabs/MBookingsTab.tsxindex c71856d00..ff2a2617c 100644--- a/client/src/mobile/screens/trip/tabs/MBookingsTab.tsx+++ b/client/src/mobile/screens/trip/tabs/MBookingsTab.tsx@@ -240,10 +240,15 @@ function BookingCard({ res, planner, canEdit, compact }: {{t('files.title')}</div><div className="flex flex-col gap-1">+ {/* A span with a button role, not a <button>: the whole card body+ is already one, and buttons cannot nest. */}{files.map(f => (<spankey={f.id}+ role="button"+ tabIndex={0}onClick={e => { e.stopPropagation(); openFile(f.url, f.original_name) }}+ onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); e.stopPropagation(); openFile(f.url, f.original_name) } }}className="flex items-center gap-[6px] rounded-[10px] border border-[color:var(--m-rowbr)] bg-m-card px-[10px] py-[7px]"><FileText size={12} strokeWidth={2} className="flex-none text-m-muted" />diff --git a/client/src/mobile/screens/trip/tabs/MFileLightbox.tsx b/client/src/mobile/screens/trip/tabs/MFileLightbox.tsxindex 79b458f5a..ef27fd758 100644--- a/client/src/mobile/screens/trip/tabs/MFileLightbox.tsx+++ b/client/src/mobile/screens/trip/tabs/MFileLightbox.tsx@@ -69,6 +69,10 @@ export default function MFileLightbox({ files, index, onIndexChange, onClose, treturn createPortal(<div+ // Backdrop, header bar and media pane are plain boxes: they only route the+ // tap-to-dismiss. Escape / arrow keys and the header buttons are the+ // keyboard equivalents, wired up in the effect above.+ role="presentation"className="m-root fixed inset-0 z-[65] flex flex-col bg-black/[.92]"onClick={onClose}onTouchStart={e => { touchStartRef.current = e.touches[0].clientX }}@@ -82,7 +86,7 @@ export default function MFileLightbox({ files, index, onIndexChange, onClose, t}}>{/* Header */}- <div className="flex flex-none items-center justify-between px-4 py-[10px]" onClick={e => e.stopPropagation()}>+ <div role="presentation" className="flex flex-none items-center justify-between px-4 py-[10px]" onClick={e => e.stopPropagation()}><span className="min-w-0 flex-1 truncate font-geist text-[0.75rem] text-white/70">{file.original_name}<span className="ml-2 text-white/40">{index + 1} / {files.length}</span>@@ -112,6 +116,7 @@ export default function MFileLightbox({ files, index, onIndexChange, onClose, t{/* Media + nav */}<div+ role="presentation"className="relative flex min-h-0 flex-1 items-center justify-center"onClick={e => {if (e.target !== e.currentTarget) return@@ -131,17 +136,20 @@ export default function MFileLightbox({ files, index, onIndexChange, onClose, t</button>)}{fileIsVideo ? (- <div onClick={e => e.stopPropagation()}>+ <div role="presentation" onClick={e => e.stopPropagation()}><VideoPlayer src={file.url} style={{ maxWidth: '92vw', maxHeight: '78vh', borderRadius: 8 }} /></div>) : (imgSrc && (- <img- src={imgSrc}- alt={file.original_name}- onClick={e => e.stopPropagation()}- className="block max-h-[78vh] max-w-[92vw] rounded-lg object-contain"- />+ // The stop sits on a wrapper rather than on the <img>: a picture is+ // not something you activate, and this keeps its alt text intact.+ <div role="presentation" onClick={e => e.stopPropagation()}>+ <img+ src={imgSrc}+ alt={file.original_name}+ className="block max-h-[78vh] max-w-[92vw] rounded-lg object-contain"+ />+ </div>))}{hasNext && (diff --git a/client/src/mobile/screens/trip/tabs/MTransportsTab.tsx b/client/src/mobile/screens/trip/tabs/MTransportsTab.tsxindex 56b16be5a..1a47bedcf 100644--- a/client/src/mobile/screens/trip/tabs/MTransportsTab.tsx+++ b/client/src/mobile/screens/trip/tabs/MTransportsTab.tsx@@ -263,7 +263,10 @@ function TransportCard({ res, planner, shell, canEdit, compact }: {{files.map(f => (<spankey={f.id}+ role="button"+ tabIndex={0}onClick={e => { e.stopPropagation(); openFile(f.url, f.original_name) }}+ onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); e.stopPropagation(); openFile(f.url, f.original_name) } }}className="flex items-center gap-[6px] rounded-[10px] border border-[color:var(--m-rowbr)] bg-m-card px-[10px] py-[7px]"><FileText size={12} strokeWidth={2} className="flex-none text-m-muted" />diff --git a/client/src/pages/AtlasPage.tsx b/client/src/pages/AtlasPage.tsxindex 02800f7af..8693385a8 100644--- a/client/src/pages/AtlasPage.tsx+++ b/client/src/pages/AtlasPage.tsx@@ -170,9 +170,9 @@ function AtlasPageDesktop(): React.ReactElement {{/* Country action popup */}{confirmAction && (- <div className="bg-[rgba(0,0,0,0.4)]" style={{ position: 'fixed', inset: 0, zIndex: 1000, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 20 }}+ <div role="presentation" className="bg-[rgba(0,0,0,0.4)]" style={{ position: 'fixed', inset: 0, zIndex: 1000, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 20 }}onClick={() => setConfirmAction(null)}>- <div className="bg-surface-card" style={{ borderRadius: 16, padding: 24, maxWidth: 340, width: '100%', boxShadow: '0 16px 48px rgba(0,0,0,0.2)', textAlign: 'center' }}+ <div role="presentation" className="bg-surface-card" style={{ borderRadius: 16, padding: 24, maxWidth: 340, width: '100%', boxShadow: '0 16px 48px rgba(0,0,0,0.2)', textAlign: 'center' }}onClick={e => e.stopPropagation()}>{confirmAction.code.length === 2 ? (<img src={`https://flagcdn.com/w80/${confirmAction.code.toLowerCase()}.png`} alt={confirmAction.code} style={{ width: 48, height: 34, borderRadius: 6, objectFit: 'cover', marginBottom: 12, display: 'inline-block' }} />@@ -202,7 +202,7 @@ function AtlasPageDesktop(): React.ReactElement {<div className="text-content-muted" style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', marginTop: 1 }}>{t('atlas.markVisitedHint')}</div></div></button>- <button onClick={() => setConfirmAction({ ...confirmAction, type: 'bucket' as any })}+ <button type="button" onClick={() => setConfirmAction({ ...confirmAction, type: 'bucket' as any })}className="border border-edge"style={{ display: 'flex', alignItems: 'center', gap: 10, width: '100%', padding: '12px 16px', borderRadius: 12, background: 'none', cursor: 'pointer', fontFamily: 'inherit', textAlign: 'left', transition: 'background 0.12s' }}onMouseEnter={e => e.currentTarget.style.background = 'var(--bg-secondary)'}@@ -241,7 +241,7 @@ function AtlasPageDesktop(): React.ReactElement {{confirmAction.countryName && (<p className="text-content-muted" style={{ margin: '-8px 0 8px', fontSize: 'calc(12px * var(--fs-scale-body, 1))' }}>{confirmAction.countryName}</p>)}- <button onClick={async () => {+ <button type="button" onClick={async () => {const { code: countryCode, name: rName, regionCode: rCode } = confirmActionif (!rCode) returntry {@@ -267,7 +267,7 @@ function AtlasPageDesktop(): React.ReactElement {<div className="text-content-muted" style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', marginTop: 1 }}>{t('atlas.markRegionVisitedHint')}</div></div></button>- <button onClick={() => setConfirmAction({ ...confirmAction, type: 'bucket' })}+ <button type="button" onClick={() => setConfirmAction({ ...confirmAction, type: 'bucket' })}className="border border-edge"style={{ display: 'flex', alignItems: 'center', gap: 10, width: '100%', padding: '12px 16px', borderRadius: 12, background: 'none', cursor: 'pointer', fontFamily: 'inherit', textAlign: 'left', transition: 'background 0.12s' }}onMouseEnter={e => e.currentTarget.style.background = 'var(--bg-secondary)'}@@ -311,7 +311,7 @@ function AtlasPageDesktop(): React.ReactElement {style={{ padding: '8px 20px', borderRadius: 10, background: 'none', fontSize: 'calc(13px * var(--fs-scale-body, 1))', cursor: 'pointer', fontFamily: 'inherit' }}>{t('common.cancel')}</button>- <button onClick={async () => {+ <button type="button" onClick={async () => {const { code: countryCode, regionCode: rCode } = confirmActionif (!rCode) returntry {@@ -386,7 +386,7 @@ function AtlasPageDesktop(): React.ReactElement {</div></div><div style={{ display: 'flex', gap: 8, justifyContent: 'center', flexWrap: 'wrap' }}>- <button onClick={() => setConfirmAction({ ...confirmAction, type: confirmAction.regionCode ? 'choose-region' : 'choose' })}+ <button type="button" onClick={() => setConfirmAction({ ...confirmAction, type: confirmAction.regionCode ? 'choose-region' : 'choose' })}className="border border-edge text-content-muted"style={{ padding: '8px 20px', borderRadius: 10, background: 'none', fontSize: 'calc(13px * var(--fs-scale-body, 1))', cursor: 'pointer', fontFamily: 'inherit' }}>{t('common.back')}@@ -586,7 +586,7 @@ function SidebarContent({ data, stats, countries, selectedCountry, countryDetail</button>)}{bucketForm.name && (- <button onClick={() => { setBucketForm({ ...bucketForm, name: '', lat: '', lng: '' }); setBucketSearch('') }}+ <button type="button" onClick={() => { setBucketForm({ ...bucketForm, name: '', lat: '', lng: '' }); setBucketSearch('') }}className="border border-edge text-content-faint"style={{ padding: '6px 8px', borderRadius: 8, background: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center' }}><X size={12} />diff --git a/client/src/pages/CollectionsPage.tsx b/client/src/pages/CollectionsPage.tsxindex 89b3cc1b4..8efb2588d 100644--- a/client/src/pages/CollectionsPage.tsx+++ b/client/src/pages/CollectionsPage.tsx@@ -294,7 +294,7 @@ function CollectionsPageDesktop(): React.ReactElement {{/* Mobile rail drawer */}{c.mobileRailOpen && (<>- <div className="col-drawer-backdrop" onClick={() => c.setMobileRailOpen(false)} />+ <div role="presentation" className="col-drawer-backdrop" onClick={() => c.setMobileRailOpen(false)} /><div className="col-drawer"><div className="col-drawer-head"><button type="button" onClick={() => c.setMobileRailOpen(false)} aria-label={t('common.close')}><X size={18} /></button>diff --git a/client/src/pages/DashboardPage.tsx b/client/src/pages/DashboardPage.tsxindex 70b6cccf0..812a49c35 100644--- a/client/src/pages/DashboardPage.tsx+++ b/client/src/pages/DashboardPage.tsx@@ -52,7 +52,7 @@ function tripGradient(id: number): string { return GRADIENTS[id % GRADIENTS.lengfunction splitDate(dateStr: string | null | undefined, locale: string): { d: string; m: string; y: string } | null {if (!dateStr) return nullconst date = new Date(dateStr + 'T00:00:00Z')- if (isNaN(date.getTime())) return null // malformed date — render a dash, never crash+ if (Number.isNaN(date.getTime())) return null // malformed date — render a dash, never crashconst otherYear = date.getUTCFullYear() !== new Date().getUTCFullYear()return {d: date.toLocaleDateString(locale, { day: 'numeric', timeZone: 'UTC' }),@@ -67,7 +67,7 @@ function splitDate(dateStr: string | null | undefined, locale: string): { d: strfunction fullDate(dateStr: string | null | undefined, locale: string): string | null {if (!dateStr) return nullconst date = new Date(dateStr + 'T00:00:00Z')- if (isNaN(date.getTime())) return null+ if (Number.isNaN(date.getTime())) return nullconst opts: Intl.DateTimeFormatOptions = { day: 'numeric', month: 'short', timeZone: 'UTC' }if (date.getUTCFullYear() !== new Date().getUTCFullYear()) opts.year = 'numeric'return date.toLocaleDateString(locale, opts)@@ -393,7 +393,13 @@ function BoardingPassHero({ trip, bundle, locale, onOpen, onEdit, onCopy, onArch)return (- <section className="hero-trip" onClick={onOpen}>+ <div+ className="hero-trip"+ onClick={onOpen}+ role="button"+ tabIndex={0}+ onKeyDown={(e) => { if (e.target === e.currentTarget && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); onOpen() } }}+ >{trip.cover_image? <img className="bg" src={trip.cover_image} alt={trip.title} />: <div className="bg" style={{ background: tripGradient(trip.id) }} />}@@ -424,12 +430,12 @@ function BoardingPassHero({ trip, bundle, locale, onOpen, onEdit, onCopy, onArch))}</div>)}- <div className="hero-pass" onClick={(e) => { e.stopPropagation(); onOpen() }}>+ <div className="hero-pass" role="presentation" onClick={(e) => { e.stopPropagation(); onOpen() }}><div className="hero-pass-inner">{passCells}</div></div></div></div>- </section>+ </div>)}@@ -552,7 +558,13 @@ function TripCard({ trip, locale, badges, onOpen, onEdit, onCopy, onArchive, onDconst stop = (e: React.MouseEvent, fn: () => void) => { e.stopPropagation(); fn() }return (- <article className="trip-card" onClick={onOpen}>+ <div+ className="trip-card"+ onClick={onOpen}+ role="button"+ tabIndex={0}+ onKeyDown={(e) => { if (e.target === e.currentTarget && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); onOpen() } }}+ ><div className="trip-cover">{trip.cover_image? <img src={trip.cover_image} alt={trip.title} />@@ -585,7 +597,7 @@ function TripCard({ trip, locale, badges, onOpen, onEdit, onCopy, onArchive, onD</div><TripCardBadges items={badges ?? []} /></div>- </article>+ </div>)}@@ -793,7 +805,9 @@ function UpcomingTool({ items, locale, onOpen }: {const timeStr = parsed.time ? formatTime(parsed.time, locale, timeFormat) : nullconst typeClass = RES_TYPE_CLASS[r.type] || 'other'return (- <div className="upc-item" key={r.id} onClick={() => onOpen(r.trip_id)}>+ <div className="upc-item" key={r.id} onClick={() => onOpen(r.trip_id)}+ role="button" tabIndex={0}+ onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onOpen(r.trip_id) } }}><div className="upc-date"><div className="d mono">{dateStr?.d ?? '–'}</div><div className="m">{dateStr?.m ?? ''}</div></div><div className="upc-info"><div className="t">{r.title}</div>diff --git a/client/src/pages/HelpPage.tsx b/client/src/pages/HelpPage.tsxindex 4d5902178..1e9d37fc5 100644--- a/client/src/pages/HelpPage.tsx+++ b/client/src/pages/HelpPage.tsx@@ -99,10 +99,11 @@ export default function HelpPage() {{/* Mobile sidebar drawer */}{navOpen && (- <div className="lg:hidden fixed inset-0 z-[120]" onClick={() => setNavOpen(false)}>+ <div className="lg:hidden fixed inset-0 z-[120]" role="presentation" onClick={() => setNavOpen(false)}><div className="absolute inset-0 bg-black/40" /><divclassName="absolute left-0 top-0 bottom-0 w-[280px] bg-surface-card p-5 overflow-y-auto shadow-xl"+ role="presentation"onClick={(e) => e.stopPropagation()}><div className="flex items-center justify-between mb-4">diff --git a/client/src/pages/JourneyPage.tsx b/client/src/pages/JourneyPage.tsxindex 0f12d8fee..c2bd784aa 100644--- a/client/src/pages/JourneyPage.tsx+++ b/client/src/pages/JourneyPage.tsx@@ -122,9 +122,10 @@ function JourneyPageDesktop() {{/* Active Journey Hero */}{activeJourney && (<div className="mb-10">- <div+ <button+ type="button"onClick={() => navigate(`/journey/${activeJourney.id}`)}- className="relative rounded-[28px] overflow-hidden cursor-pointer h-[250px] md:h-[280px] transition-transform duration-300 ease-[cubic-bezier(0.23,1,0.32,1)] hover:-translate-y-1 shadow-[0_2px_4px_rgba(0,0,0,0.06),0_20px_48px_-18px_rgba(0,0,0,0.32)]"+ className="block w-full text-left relative rounded-[28px] overflow-hidden cursor-pointer h-[250px] md:h-[280px] transition-transform duration-300 ease-[cubic-bezier(0.23,1,0.32,1)] hover:-translate-y-1 shadow-[0_2px_4px_rgba(0,0,0,0.06),0_20px_48px_-18px_rgba(0,0,0,0.32)]"style={{background: activeJourney.cover_image? `linear-gradient(120deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.15) 45%, rgba(0,0,0,0.05) 100%), url(/uploads/${activeJourney.cover_image}) center/cover`@@ -188,7 +189,7 @@ function JourneyPageDesktop() {</div></div></div>- </div>+ </button></div>)}@@ -283,16 +284,24 @@ function JourneyPageDesktop() {upcoming: 'bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400',}+ const toggleTrip = () => {+ setSelectedTripIds(prev => {+ const next = new Set(prev)+ if (next.has(trip.id)) next.delete(trip.id)+ else next.add(trip.id)+ return next+ })+ }+return (<divkey={trip.id}- onClick={() => {- setSelectedTripIds(prev => {- const next = new Set(prev)- if (next.has(trip.id)) next.delete(trip.id)- else next.add(trip.id)- return next- })+ role="checkbox"+ aria-checked={selected}+ tabIndex={0}+ onClick={toggleTrip}+ onKeyDown={e => {+ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleTrip() }}}className={`flex items-center gap-3 p-3 rounded-xl border cursor-pointer transition-[border-color,background-color] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] ${selected@@ -366,9 +375,10 @@ function JourneyCard({ journey, onClick }: { journey: Journey & { entry_count?:const lifecycle = computeJourneyLifecycle(j.status, j.trip_date_min, j.trip_date_max)return (- <div+ <button+ type="button"onClick={onClick}- className="vg-card rounded-[24px] overflow-hidden cursor-pointer transition-[transform,box-shadow] duration-300 ease-[cubic-bezier(0.23,1,0.32,1)] hover:-translate-y-1 flex flex-col"+ className="vg-card w-full text-left rounded-[24px] overflow-hidden cursor-pointer transition-[transform,box-shadow] duration-300 ease-[cubic-bezier(0.23,1,0.32,1)] hover:-translate-y-1 flex flex-col">{/* Cover with title overlay */}<div className="relative h-[200px] overflow-hidden" style={{ background: pickGradient(j.id) }}>@@ -415,6 +425,6 @@ function JourneyCard({ journey, onClick }: { journey: Journey & { entry_count?:))}</div></div>- </div>+ </button>)}diff --git a/client/src/pages/JourneyPublicPage.tsx b/client/src/pages/JourneyPublicPage.tsxindex 76e11a02f..370e27817 100644--- a/client/src/pages/JourneyPublicPage.tsx+++ b/client/src/pages/JourneyPublicPage.tsx@@ -241,8 +241,9 @@ export default function JourneyPublicPage() {>{/* Photo area */}{photos.length === 1 && (- <div- className="relative cursor-pointer"+ <button+ type="button"+ className="relative block w-full cursor-pointer text-left"onClick={() => setLightbox({ photos: lightboxPhotos, index: 0 })}><img src={photoUrl(photos[0], token!)} className="h-64 w-full object-cover" alt="" />@@ -269,26 +270,32 @@ export default function JourneyPublicPage() {</h3></div>)}- </div>+ </button>)}{photos.length === 2 && (<div className="grid grid-cols-2 gap-0.5 overflow-hidden">{photos.slice(0, 2).map((p, i) => (- <img+ <buttonkey={p.id}- src={photoUrl(p, token!, 'thumbnail')}- alt=""- className="h-52 w-full cursor-pointer object-cover"+ type="button"+ className="block h-52 w-full cursor-pointer overflow-hidden"onClick={() => setLightbox({ photos: lightboxPhotos, index: i })}- />+ >+ <img+ src={photoUrl(p, token!, 'thumbnail')}+ alt=""+ className="h-full w-full object-cover"+ />+ </button>))}</div>)}{photos.length >= 3 && (<div className="flex overflow-hidden" style={{ height: 280, gap: 2 }}>- <div+ <button+ type="button"className="min-w-0 flex-1 cursor-pointer"onClick={() => setLightbox({ photos: lightboxPhotos, index: 0 })}>@@ -297,9 +304,10 @@ export default function JourneyPublicPage() {alt=""className="h-full w-full object-cover"/>- </div>+ </button><div className="flex min-w-0 flex-1 flex-col" style={{ gap: 2 }}>- <div+ <button+ type="button"className="min-h-0 flex-1 cursor-pointer"onClick={() => setLightbox({ photos: lightboxPhotos, index: 1 })}>@@ -308,8 +316,9 @@ export default function JourneyPublicPage() {alt=""className="h-full w-full object-cover"/>- </div>- <div+ </button>+ <button+ type="button"className="relative min-h-0 flex-1 cursor-pointer"onClick={() => setLightbox({ photos: lightboxPhotos, index: 2 })}>@@ -325,13 +334,27 @@ export default function JourneyPublicPage() {</span></div>)}- </div>+ </button></div></div>)}{/* Content */}- <div className="cursor-pointer px-5 pb-5 pt-4" onClick={() => setViewingEntry(entry)}>+ {/* Stays a div: the story renders user markdown, links included,+ and a link may not sit inside a <button>. */}+ <div+ role="button"+ tabIndex={0}+ className="cursor-pointer px-5 pb-5 pt-4"+ onClick={() => setViewingEntry(entry)}+ onKeyDown={(e) => {+ if (e.target !== e.currentTarget) return;+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ setViewingEntry(entry);+ }+ }}+ >{/* Title (only when no single photo — photo has it in overlay) */}{photos.length !== 1 && entry.title && (<h3 className="mb-2 text-[16px] font-semibold leading-snug tracking-tight text-zinc-900 dark:text-white">@@ -458,9 +481,10 @@ export default function JourneyPublicPage() {const renderGallery = () => (<div className="grid grid-cols-2 gap-1.5 sm:grid-cols-3 md:grid-cols-4">{allPhotos.map((photo, idx) => (- <div+ <buttonkey={photo.id}- className="relative aspect-square cursor-pointer overflow-hidden rounded-lg"+ type="button"+ className="relative block aspect-square w-full cursor-pointer overflow-hidden rounded-lg"onClick={() =>setLightbox({photos: allPhotos.map((p) => ({@@ -486,7 +510,7 @@ export default function JourneyPublicPage() {</span></div>)}- </div>+ </button>))}</div>);@@ -594,6 +618,7 @@ export default function JourneyPublicPage() {>{SUPPORTED_LANGUAGES.map((lang) => (<button+ type="button"key={lang.value}onClick={() => {useSettingsStore.setState((s) => ({ settings: { ...s.settings, language: lang.value } }));diff --git a/client/src/pages/LoginPage.tsx b/client/src/pages/LoginPage.tsxindex 75dd09970..1ac70517d 100644--- a/client/src/pages/LoginPage.tsx+++ b/client/src/pages/LoginPage.tsx@@ -265,7 +265,12 @@ export default function LoginPage(): React.ReactElement {<divrole="listbox"aria-label="Select language"+ tabIndex={-1}+ /* Both handlers do the one job: keep the event from reaching the+ document listener that closes the dropdown. The options below are+ real buttons and carry the keyboard interaction themselves. */onClick={(e) => e.stopPropagation()}+ onKeyDown={(e) => e.stopPropagation()}style={{position: 'absolute',top: '100%',@@ -934,7 +939,13 @@ export default function LoginPage(): React.ReactElement {onToggle={() => setRememberMe(!rememberMe)}label={t('login.rememberMe')}/>+ {/* The visible caption repeats the switch's own aria-label and+ clicking it is a mouse shortcut for hitting the switch.+ Hidden from assistive tech so it does not read out as a+ second "Remember me" control: the switch above is the one+ that carries the name, the focus and the keyboard. */}<span+ aria-hidden="true"onClick={() => setRememberMe(!rememberMe)}style={{cursor: 'pointer',diff --git a/client/src/pages/SharedTripPage.test.tsx b/client/src/pages/SharedTripPage.test.tsxindex 5fd60f6f7..7e710eaa6 100644--- a/client/src/pages/SharedTripPage.test.tsx+++ b/client/src/pages/SharedTripPage.test.tsx@@ -506,7 +506,9 @@ describe('SharedTripPage', () => {// the day picker above the map was added (#1962): once as a chip, once on the card.await waitFor(() => expect(screen.getAllByText('Tag 1')).toHaveLength(2));const labels = screen.getAllByText('Tag 1');- expect(labels.filter((el) => el.closest('button'))).toHaveLength(1);+ // One of each: the picker chip carries aria-pressed, the day card's header aria-expanded.+ expect(labels.filter((el) => el.closest('[aria-pressed]'))).toHaveLength(1);+ expect(labels.filter((el) => el.closest('[aria-expanded]'))).toHaveLength(1);});});@@ -709,7 +711,9 @@ describe('SharedTripPage', () => {// Twice since the day picker landed (#1962): the chip above the map and the card.const dayLabels = screen.getAllByText('Day 1');expect(dayLabels).toHaveLength(2);- expect(dayLabels.filter((el) => el.closest('button'))).toHaveLength(1);+ // One of each: the picker chip carries aria-pressed, the day card's header aria-expanded.+ expect(dayLabels.filter((el) => el.closest('[aria-pressed]'))).toHaveLength(1);+ expect(dayLabels.filter((el) => el.closest('[aria-expanded]'))).toHaveLength(1);expect(screen.getByText('Hotel Lutetia')).toBeInTheDocument();expect(screen.getByText('0 places')).toBeInTheDocument();// No date row for an undated day.diff --git a/client/src/pages/SharedTripPage.tsx b/client/src/pages/SharedTripPage.tsxindex 319256acf..19fbf87b3 100644--- a/client/src/pages/SharedTripPage.tsx+++ b/client/src/pages/SharedTripPage.tsx@@ -360,6 +360,7 @@ export default function SharedTripPage() {>{SUPPORTED_LANGUAGES.map((lang) => (<button+ type="button"key={lang.value}onClick={() => {// Set language locally without API call (shared page has no auth)@@ -540,14 +541,21 @@ export default function SharedTripPage() {className="border border-edge-faint bg-surface-card"style={{ borderRadius: 14, overflow: 'hidden' }}>- <div+ <button+ type="button"onClick={() => setSelectedDay(selectedDay === day.id ? null : day.id)}+ aria-expanded={selectedDay === day.id}style={{padding: '12px 16px',cursor: 'pointer',display: 'flex',alignItems: 'center',gap: 10,+ width: '100%',+ background: 'none',+ border: 'none',+ textAlign: 'left',+ fontFamily: 'inherit',}}><div@@ -632,7 +640,7 @@ export default function SharedTripPage() {>{dayPlaceCount} {t('shared.places')}</span>- </div>+ </button>{selectedDay === day.id && merged.length > 0 && (<div style={{ padding: '0 16px 12px', display: 'flex', flexDirection: 'column', gap: 6 }}>@@ -796,6 +804,7 @@ export default function SharedTripPage() {{place.image_url ? (<imgsrc={place.image_url}+ alt=""style={{ width: 28, height: 28, borderRadius: '50%', objectFit: 'cover' }}/>) : (@@ -1099,7 +1108,7 @@ export default function SharedTripPage() {style={{ fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontWeight: 600 }}>{item.total_price- ? `${convert(parseFloat(item.total_price) || 0, curOf(item)).toLocaleString(locale, { minimumFractionDigits: 2 })} ${base}`+ ? `${convert(Number.parseFloat(item.total_price) || 0, curOf(item)).toLocaleString(locale, { minimumFractionDigits: 2 })} ${base}`: '—'}</span></div>@@ -1183,6 +1192,7 @@ export default function SharedTripPage() {{msg.avatar ? (<imgsrc={avatarSrc(msg.avatar)!}+ alt=""style={{ width: '100%', height: '100%', objectFit: 'cover' }}/>) : (diff --git a/client/src/pages/TripPlannerPage.tsx b/client/src/pages/TripPlannerPage.tsxindex 241ab686d..6f7c99375 100644--- a/client/src/pages/TripPlannerPage.tsx+++ b/client/src/pages/TripPlannerPage.tsx@@ -502,6 +502,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {/>{!leftCollapsed && (<div+ role="presentation"onMouseDown={startResizeLeft}style={{ position: 'absolute', right: 0, top: 0, bottom: 0, width: 4, cursor: 'col-resize', background: 'transparent' }}onMouseEnter={e => e.currentTarget.style.background = 'rgba(0,0,0,0.08)'}@@ -539,6 +540,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {}}>{!rightCollapsed && (<div+ role="presentation"onMouseDown={startResizeRight}style={{ position: 'absolute', left: 0, top: 0, bottom: 0, width: 4, cursor: 'col-resize', background: 'transparent' }}onMouseEnter={e => e.currentTarget.style.background = 'rgba(0,0,0,0.08)'}@@ -653,8 +655,8 @@ function TripPlannerPageDesktop(): React.ReactElement | null {)}{selectedPlace && isMobile && createPortal(- <div className="bg-[rgba(0,0,0,0.3)]" style={{ position: 'fixed', inset: 0, zIndex: 9999, display: 'flex', alignItems: 'flex-end', justifyContent: 'center', paddingBottom: 'var(--bottom-nav-h)' }} onClick={() => setSelectedPlaceId(null)}>- <div style={{ width: '100%', maxHeight: '85vh' }} onClick={e => e.stopPropagation()}>+ <div className="bg-[rgba(0,0,0,0.3)]" style={{ position: 'fixed', inset: 0, zIndex: 9999, display: 'flex', alignItems: 'flex-end', justifyContent: 'center', paddingBottom: 'var(--bottom-nav-h)' }} role="presentation" onClick={() => setSelectedPlaceId(null)}>+ <div style={{ width: '100%', maxHeight: '85vh' }} role="presentation" onClick={e => e.stopPropagation()}><PlaceInspectoronEditTransport={openLinkedTransport}onEditReservation={openLinkedReservation}@@ -698,8 +700,8 @@ function TripPlannerPageDesktop(): React.ReactElement | null {)}{mobileSidebarOpen && createPortal(- <div className="bg-[rgba(0,0,0,0.3)]" style={{ position: 'fixed', inset: 0, zIndex: 9999 }} onClick={() => setMobileSidebarOpen(null)}>- <div className="bg-surface-card" style={{ position: 'absolute', top: 'var(--nav-h)', left: 0, right: 0, bottom: 0, display: 'flex', flexDirection: 'column', overflow: 'hidden' }} onClick={e => e.stopPropagation()}>+ <div className="bg-[rgba(0,0,0,0.3)]" style={{ position: 'fixed', inset: 0, zIndex: 9999 }} role="presentation" onClick={() => setMobileSidebarOpen(null)}>+ <div className="bg-surface-card" style={{ position: 'absolute', top: 'var(--nav-h)', left: 0, right: 0, bottom: 0, display: 'flex', flexDirection: 'column', overflow: 'hidden' }} role="presentation" onClick={e => e.stopPropagation()}><div className="border-b border-edge-secondary" style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '14px 16px' }}><span className="text-content" style={{ fontWeight: 600, fontSize: 'calc(14px * var(--fs-scale-body, 1))' }}>{mobileSidebarOpen === 'left' ? t('trip.mobilePlan') : t('trip.mobilePlaces')}</span><button type="button" onClick={() => setMobileSidebarOpen(null)} className="bg-surface-tertiary text-content" style={{ border: 'none', borderRadius: '50%', width: 28, height: 28, cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>diff --git a/client/src/pages/VacayPage.tsx b/client/src/pages/VacayPage.tsxindex cbfa25860..56e4728c1 100644--- a/client/src/pages/VacayPage.tsx+++ b/client/src/pages/VacayPage.tsx@@ -67,7 +67,8 @@ function VacayPageDesktop(): React.ReactElement {</div><div className="grid grid-cols-4 gap-1.5">{years.map(y => (- <div key={y} onClick={() => setSelectedYear(y)}+ <div key={y} role="button" tabIndex={0} onClick={() => setSelectedYear(y)}+ onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setSelectedYear(y) } }}className="group relative rounded-[9px] text-center cursor-pointer transition-[background-color,color] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)]"style={{padding: '7px 0',@@ -78,10 +79,11 @@ function VacayPageDesktop(): React.ReactElement {}}>{y}{years.length > 1 && (- <span onClick={e => { e.stopPropagation(); setDeleteYear(y); setShowMobileSidebar(false) }}+ <button type="button" aria-label={t('vacay.removeYear')}+ onClick={e => { e.stopPropagation(); setDeleteYear(y); setShowMobileSidebar(false) }}className="absolute -top-1 -right-1 w-3.5 h-3.5 rounded-full bg-red-500 text-white text-[7px] flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"><Minus size={7} />- </span>+ </button>)}</div>))}@@ -168,7 +170,7 @@ function VacayPageDesktop(): React.ReactElement {{/* Mobile Sidebar Drawer */}{showMobileSidebar && createPortal(<div className="fixed inset-0 lg:hidden" style={{ zIndex: 99980 }}>- <div className="absolute inset-0 bg-[rgba(0,0,0,0.4)]" onClick={() => setShowMobileSidebar(false)} />+ <div className="absolute inset-0 bg-[rgba(0,0,0,0.4)]" role="presentation" onClick={() => setShowMobileSidebar(false)} /><div className="absolute left-0 top-0 bottom-0 w-[280px] overflow-y-auto p-3 flex flex-col gap-3 bg-surface"style={{ boxShadow: '4px 0 24px rgba(0,0,0,0.15)', animation: 'slideInLeft 0.2s ease-out' }}>{sidebarContent}diff --git a/client/src/pages/admin/AdminNotificationsTab.tsx b/client/src/pages/admin/AdminNotificationsTab.tsxindex 7f7c18d7c..1e33620e8 100644--- a/client/src/pages/admin/AdminNotificationsTab.tsx+++ b/client/src/pages/admin/AdminNotificationsTab.tsx@@ -101,7 +101,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa<span className="text-xs font-medium text-slate-500">Skip TLS certificate check</span><p className="text-[10px] text-slate-400 mt-0.5">Enable for self-signed certificates on local mail servers</p></div>- <button onClick={() => {+ <button type="button" onClick={() => {const newVal = smtpValues.smtp_skip_tls_verify === 'true' ? 'false' : 'true'setSmtpValues(prev => ({ ...prev, smtp_skip_tls_verify: newVal }))}}@@ -193,7 +193,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa<h2 className="font-semibold text-slate-900">{t('admin.notifications.tripReminders.title')}</h2><p className="text-xs text-slate-400 mt-1">{t('admin.notifications.tripReminders.hint')}</p></div>- <button+ <button type="button"onClick={async () => {const next = !tripRemindersActivesetSmtpValues(prev => ({ ...prev, notify_trip_reminder: next ? 'true' : 'false' }))@@ -312,7 +312,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTaclassName="flex-1 px-3 py-2 border border-slate-300 rounded-lg text-sm focus:ring-2 focus:ring-slate-400 focus:border-transparent"/>{smtpValues.admin_ntfy_token === '••••••••' && (- <button+ <button type="button"onClick={async () => {try {await authApi.updateAppSettings({ admin_ntfy_token: '' })diff --git a/client/src/pages/admin/AdminSettingsTab.tsx b/client/src/pages/admin/AdminSettingsTab.tsxindex 95c04d3db..fa164d6f3 100644--- a/client/src/pages/admin/AdminSettingsTab.tsx+++ b/client/src/pages/admin/AdminSettingsTab.tsx@@ -496,8 +496,9 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R<p className="text-xs text-slate-400 mt-1">{t('admin.oidcIssuerHint')}</p></div><div>- <label className="block text-sm font-medium text-slate-700 mb-1.5">Discovery URL <span className="text-slate-400 font-normal">(optional)</span></label>+ <label htmlFor="oidc-discovery-url" className="block text-sm font-medium text-slate-700 mb-1.5">Discovery URL <span className="text-slate-400 font-normal">(optional)</span></label><input+ id="oidc-discovery-url"type="url"value={oidcConfig.discovery_url}onChange={e => setOidcConfig(c => ({ ...c, discovery_url: e.target.value }))}@@ -507,8 +508,9 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R<p className="text-xs text-slate-400 mt-1">Override the auto-constructed discovery URL. Required for providers like Authentik where the endpoint is not at <code className="bg-slate-100 px-1 rounded">{'<issuer>/.well-known/openid-configuration'}</code>.</p></div><div>- <label className="block text-sm font-medium text-slate-700 mb-1.5">Client ID</label>+ <label htmlFor="oidc-client-id" className="block text-sm font-medium text-slate-700 mb-1.5">Client ID</label><input+ id="oidc-client-id"type="text"value={oidcConfig.client_id}onChange={e => setOidcConfig(c => ({ ...c, client_id: e.target.value }))}@@ -516,8 +518,9 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R/></div><div>- <label className="block text-sm font-medium text-slate-700 mb-1.5">Client Secret</label>+ <label htmlFor="oidc-client-secret" className="block text-sm font-medium text-slate-700 mb-1.5">Client Secret</label><input+ id="oidc-client-secret"type="password"value={oidcConfig.client_secret}onChange={e => setOidcConfig(c => ({ ...c, client_secret: e.target.value }))}diff --git a/client/src/pages/admin/AdminUserModals.tsx b/client/src/pages/admin/AdminUserModals.tsxindex 005f1d4b0..706d6dd65 100644--- a/client/src/pages/admin/AdminUserModals.tsx+++ b/client/src/pages/admin/AdminUserModals.tsx@@ -244,9 +244,11 @@ export default function AdminUserModals({ admin, t }: AdminUserModalsProps): ReajustifyContent: 'center',padding: 16,}}+ role="presentation"onClick={() => setShowUpdateModal(false)}><div+ role="presentation"onClick={(e) => e.stopPropagation()}style={{ width: '100%', maxWidth: 440, borderRadius: 16, overflow: 'hidden' }}className="border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800"diff --git a/client/src/pages/atlas/atlasModel.ts b/client/src/pages/atlas/atlasModel.tsindex a806b29c6..632d21888 100644--- a/client/src/pages/atlas/atlasModel.ts+++ b/client/src/pages/atlas/atlasModel.ts@@ -116,7 +116,9 @@ export function normalizeRegionName(name: string): string {return name.normalize('NFD').replace(/[̀-ͯ]/g, '') // strip combining diacritics.replace(/[‐-―]/g, '-') // fold hyphen/dash variants to "-"- .replace(/\s*-\s*/g, '-') // collapse spaced dashes ("A – B" vs "A-B")+ // Collapse spaced dashes ("A – B" vs "A-B"). split/trim, not /\s*-\s*/g:+ // that pattern backtracks over every space in a dash-less name (quadratic).+ .split('-').map(part => part.trim()).join('-').toLowerCase().trim()}@@ -180,7 +182,7 @@ export const COUNTRY_COLORS = ['#6366f1', '#ec4899', '#14b8a6', '#f97316', '#8b5// every other country's color each time one more was marked or added.export function countryColor(a3: string): string {let hash = 0- for (let i = 0; i < a3.length; i++) hash = (hash * 31 + a3.charCodeAt(i)) >>> 0+ for (let i = 0; i < a3.length; i++) hash = (hash * 31 + a3.codePointAt(i)) >>> 0return COUNTRY_COLORS[hash % COUNTRY_COLORS.length]}@@ -214,7 +216,7 @@ export function regionCacheEvictions(order: string[], keep: Set<string>, max: nu// Convert country code to flag emojiexport function countryCodeToFlag(code: string): string {if (!code || code.length !== 2) return ''- return String.fromCodePoint(...[...code.toUpperCase()].map(c => 0x1F1E6 + c.charCodeAt(0) - 65))+ return String.fromCodePoint(...[...code.toUpperCase()].map(c => 0x1F1E6 + c.codePointAt(0) - 65))}// ISO-3166-1 alpha-2 → alpha-3 mapping. Two sources feed this table:diff --git a/client/src/store/settingsStore.ts b/client/src/store/settingsStore.tsindex 2d9548f90..9ec2a5400 100644--- a/client/src/store/settingsStore.ts+++ b/client/src/store/settingsStore.ts@@ -76,7 +76,7 @@ export const useSettingsStore = create<SettingsState>((set, get) => ({isLoaded: false,loadSettings: async () => {- if (_loadInFlight) return _loadInFlight+ if (_loadInFlight !== null) return _loadInFlight_loadInFlight = (async () => {try {const data = await settingsApi.get()diff --git a/client/src/styles/studio.css b/client/src/styles/studio.cssindex ff2561e26..5159bead9 100644--- a/client/src/styles/studio.css+++ b/client/src/styles/studio.css@@ -889,7 +889,6 @@box-shadow: var(--glass-shadow), var(--glass-highlight);backdrop-filter: blur(30px) saturate(1.8);-webkit-backdrop-filter: blur(30px) saturate(1.8);- z-index: 2;}.trek-dash .st-zoom button {width: 32px;diff --git a/client/src/utils/dayMerge.ts b/client/src/utils/dayMerge.tsindex 871668a2c..302925694 100644--- a/client/src/utils/dayMerge.ts+++ b/client/src/utils/dayMerge.ts@@ -13,7 +13,7 @@ export function parseTimeToMinutes(time?: string | null): number | null {return h * 60 + m}const parts = time.split(':').map(Number)- if (parts.length >= 2 && !isNaN(parts[0]) && !isNaN(parts[1])) return parts[0] * 60 + parts[1]+ if (parts.length >= 2 && !Number.isNaN(parts[0]) && !Number.isNaN(parts[1])) return parts[0] * 60 + parts[1]return null}diff --git a/client/src/utils/formatters.ts b/client/src/utils/formatters.tsindex 018b674f4..047b83be5 100644--- a/client/src/utils/formatters.ts+++ b/client/src/utils/formatters.ts@@ -183,7 +183,7 @@ export function formatTime(timeStr: string | null | undefined, locale: string, tconst parts = (parseMeridiemTime(timeStr) ?? timeStr).split(':')const h = Number(parts[0]) || 0const m = Number(parts[1]) || 0- if (isNaN(h)) return timeStr+ if (Number.isNaN(h)) return timeStrif (timeFormat === '12h') return to12h(h, m)const str = `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`return locale?.startsWith('de') ? `${str} Uhr` : str@@ -200,7 +200,7 @@ export function formatClockTime(value: string | null | undefined, is12h: booleanif (!value) return ''const norm = parseMeridiemTime(value) ?? valueconst [h, m] = norm.split(':').map(Number)- if (isNaN(h) || isNaN(m)) return value+ if (!Number.isFinite(h) || !Number.isFinite(m)) return valuereturn is12h ? to12h(h, m) : norm}diff --git a/client/tests/unit/mobile/trip/MFileLightbox.test.tsx b/client/tests/unit/mobile/trip/MFileLightbox.test.tsxindex 35a000fb3..654c0ba50 100644--- a/client/tests/unit/mobile/trip/MFileLightbox.test.tsx+++ b/client/tests/unit/mobile/trip/MFileLightbox.test.tsx@@ -151,7 +151,9 @@ describe('MFileLightbox', () => {const img = await screen.findByAltText('beach.jpg')fireEvent.click(img)expect(onClose).not.toHaveBeenCalled()- fireEvent.click(img.parentElement as HTMLElement)+ // The picture now sits in a wrapper that swallows the tap for it — the+ // <img> itself carries no handler — so the empty area is one level up.+ fireEvent.click(img.parentElement?.parentElement as HTMLElement)expect(onClose).toHaveBeenCalledTimes(1)})diff --git a/client/tests/unit/mobile/trip/MPlaceSheet.test.tsx b/client/tests/unit/mobile/trip/MPlaceSheet.test.tsxindex 37e736525..f230f504c 100644--- a/client/tests/unit/mobile/trip/MPlaceSheet.test.tsx+++ b/client/tests/unit/mobile/trip/MPlaceSheet.test.tsx@@ -297,7 +297,9 @@ describe('MPlaceSheet', () => {const planner = makePlanner({ files: [] })renderSheet(planner)expect(screen.getByText('Files')).toBeInTheDocument()- fireEvent.click(screen.getByRole('button', { name: /Upload/ }))+ // The files row itself is a button now (it expands the list), so match the+ // upload control by its exact name rather than a substring.+ fireEvent.click(screen.getByRole('button', { name: 'Upload' }))const input = document.querySelector('input[type="file"][multiple]') as HTMLInputElementselectFiles(input, [new File(['a'], 'a.pdf'), new File(['b'], 'b.pdf')])diff --git a/plugin-sdk/src/cli/checks/context.ts b/plugin-sdk/src/cli/checks/context.tsindex 753a094e4..76fe70520 100644--- a/plugin-sdk/src/cli/checks/context.ts+++ b/plugin-sdk/src/cli/checks/context.ts@@ -30,7 +30,7 @@ export function loadContext(try {// Tolerate a UTF-8 BOM. Windows editors add one, and a bare JSON.parse then fails with a// cryptic "Unexpected token" pointing at an invisible character. Same rule as readJsonFile.- const text = manifestRaw.charCodeAt(0) === 0xfeff ? manifestRaw.slice(1) : manifestRaw;+ const text = manifestRaw.codePointAt(0) === 0xfeff ? manifestRaw.slice(1) : manifestRaw;const parsed: unknown = JSON.parse(text);if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {manifestError = 'trek-plugin.json is not a JSON object';@@ -56,10 +56,10 @@ export function loadContext(/** Convenience for tests and for callers that already hold the strings. */export function makeContext(over: Partial<CheckContext> & { dir?: string }): CheckContext {- const files = new Set<string>();return {dir: over.dir ?? '/plugin',- exists: (rel: string) => files.has(rel),+ // Nothing is on disk here unless the caller passes its own `exists`.+ exists: () => false,...over,};}diff --git a/plugin-sdk/src/cli/checks/network.ts b/plugin-sdk/src/cli/checks/network.tsindex 08e8a2a66..4e321f2e4 100644--- a/plugin-sdk/src/cli/checks/network.ts+++ b/plugin-sdk/src/cli/checks/network.ts@@ -57,7 +57,9 @@ function targetVersions(c: CheckContext): RegistryEntryVersion[] {return c.allVersions ? vs : vs.slice(0, 1);}-async function fetchText(url: string, headers: Record<string, string> = { 'User-Agent': 'trek-plugin-preflight' }): Promise<string | null> {+const PLAIN_HEADERS: Record<string, string> = { 'User-Agent': 'trek-plugin-preflight' };++async function fetchText(url: string, headers: Record<string, string> = PLAIN_HEADERS): Promise<string | null> {try {const r = await fetch(url, { headers });return r.ok ? await r.text() : null;diff --git a/plugin-sdk/src/cli/create.ts b/plugin-sdk/src/cli/create.tsindex 0302894d8..64e12b466 100644--- a/plugin-sdk/src/cli/create.ts+++ b/plugin-sdk/src/cli/create.ts@@ -113,7 +113,7 @@ export function scaffold(name: string, type: string, targetDir: string, opts: Scif (fs.existsSync(root)) throw new Error(`${root} already exists`);fs.mkdirSync(path.join(root, 'server'), { recursive: true });- const displayName = name.replace(/-/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());+ const displayName = name.replaceAll('-', ' ').replaceAll(/\b\w/g, (c) => c.toUpperCase());let perms = opts.permissions?.length ? opts.permissions : ['db:own'];const egress = opts.egress ?? [];if (isChannel) {diff --git a/plugin-sdk/src/cli/json.ts b/plugin-sdk/src/cli/json.tsindex eb379225e..9a8b003d0 100644--- a/plugin-sdk/src/cli/json.ts+++ b/plugin-sdk/src/cli/json.ts@@ -7,5 +7,5 @@ import fs from 'node:fs';*/export function readJsonFile<T = unknown>(p: string): T {const text = fs.readFileSync(p, 'utf8');- return JSON.parse(text.charCodeAt(0) === 0xfeff ? text.slice(1) : text) as T;+ return JSON.parse(text.codePointAt(0) === 0xfeff ? text.slice(1) : text) as T;}diff --git a/plugin-sdk/src/egress-policy.ts b/plugin-sdk/src/egress-policy.tsindex 3ba721c41..6c8130d09 100644--- a/plugin-sdk/src/egress-policy.ts+++ b/plugin-sdk/src/egress-policy.ts@@ -91,7 +91,10 @@ function embeddedTransitionIpv4(g: number[]): string | null {/** Expand an IPv6 literal into its 8 numeric hextets, or null if not a valid IPv6. */function expandV6(ip: string): number[] | null {- let h = ip.toLowerCase().replace(/%.*$/, '');+ // Cut the zone id off (`fe80::1%eth0`): indexOf rather than a `%.*$` regex, whose+ // greedy tail rescans the whole string once per `%` on a host that never matches.+ const zone = ip.indexOf('%');+ let h = (zone === -1 ? ip : ip.slice(0, zone)).toLowerCase();if (!h.includes(':')) return null;const dotted = h.match(/^(.*:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);if (dotted) {@@ -104,7 +107,7 @@ function expandV6(ip: string): number[] | null {const head = halves[0] ? halves[0].split(':') : [];const tail = halves.length === 2 && halves[1] ? halves[1].split(':') : [];const groups =- halves.length === 2 ? [...head, ...Array(8 - head.length - tail.length).fill('0'), ...tail] : head;+ halves.length === 2 ? [...head, ...new Array(8 - head.length - tail.length).fill('0'), ...tail] : head;if (groups.length !== 8) return null;const nums = groups.map((x) => (x === '' ? Number.NaN : Number.parseInt(x, 16)));return nums.some((n) => !Number.isInteger(n) || n < 0 || n > 0xffff) ? null : nums;diff --git a/plugin-sdk/src/mock-host.ts b/plugin-sdk/src/mock-host.tsindex b79f79164..2f743bb18 100644--- a/plugin-sdk/src/mock-host.ts+++ b/plugin-sdk/src/mock-host.ts@@ -214,11 +214,14 @@ function stripLeadingComments(sql: string): string {// The host's stripEmoji (text-sanitize.ts), copied so notify.send cleans/rejects the// same strings without a server import: colour emoji + sequence glue removed, then// the horizontal gaps they leave are collapsed. An all-emoji title becomes ''.-const EMOJI_RE = /\p{Emoji_Presentation}|\p{Emoji_Modifier}|\p{Regional_Indicator}|[\u200D\uFE00-\uFE0F\u20E3\u{E0020}-\u{E007F}]/gu;+const EMOJI_RE = /\p{Emoji_Presentation}|\p{Emoji_Modifier}|\p{Regional_Indicator}|\u200D|[\uFE00-\uFE0F\u20E3\u{E0020}-\u{E007F}]/gu;function stripEmoji(s: string): string {const stripped = s.replace(EMOJI_RE, '');if (stripped === s) return s;- return stripped.replace(/[^\S\r\n]{2,}/g, ' ').replace(/ +$/gm, '').trim();+ // Trailing-space trim as the host spells it: the char in front of the run (or the+ // line start) comes into the match and goes back out, so the run is only walked+ // from its own start instead of restarting inside every space of a long one.+ return stripped.replace(/[^\S\r\n]{2,}/g, ' ').replace(/(^|[^ ]) +$/gm, '$1').trim();}// The host's settings-key rules (install/manifest.ts). A field the host would refuse todiff --git a/plugin-sdk/src/zip.ts b/plugin-sdk/src/zip.tsindex 199a30174..08457a289 100644--- a/plugin-sdk/src/zip.ts+++ b/plugin-sdk/src/zip.ts@@ -58,7 +58,7 @@ export function makeZip(files: ZipInput[]): Buffer {let offset = 0;for (const f of files) {- const nameBuf = Buffer.from(f.name.replace(/\\/g, '/'), 'utf8');+ const nameBuf = Buffer.from(f.name.replaceAll(/\\/g, '/'), 'utf8');const crc = crc32(f.data);// Deflate; fall back to stored if that somehow grows the data.const deflated = zlib.deflateRawSync(f.data, { level: 9 });diff --git a/server/src/app-config/app-url.ts b/server/src/app-config/app-url.tsindex f91f5038e..ce53e3641 100644--- a/server/src/app-config/app-url.ts+++ b/server/src/app-config/app-url.ts@@ -1,4 +1,5 @@import { readEnv } from './env';+import { stripTrailingSlashes } from './parsers';/*** Instance base-URL resolution: APP_URL → first ALLOWED_ORIGINS entry →@@ -12,7 +13,7 @@ export function getAppUrl(): string {if (appUrl) {try {const _ = new URL(appUrl);- return appUrl.replace(/\/+$/, '');+ return stripTrailingSlashes(appUrl);} catch (_ignored) {}}const origins = readEnv().http.allowedOriginsRaw;@@ -21,7 +22,7 @@ export function getAppUrl(): string {if (first) {try {const _ = new URL(first);- return first.replace(/\/+$/, '');+ return stripTrailingSlashes(first);} catch (_ignored) {}}}diff --git a/server/src/app-config/parsers.ts b/server/src/app-config/parsers.tsindex ebaca568a..fb148b5c3 100644--- a/server/src/app-config/parsers.ts+++ b/server/src/app-config/parsers.ts@@ -68,9 +68,13 @@ export function csvListFiltered(raw: string | undefined): string[] | null {: null;}-/** Strip ALL trailing slashes (`/\/+$/`) — app-url.getAppUrl / TRANSIT_API_URL variant. */+/** Strip ALL trailing slashes (`/\/+$/`) — app-url.getAppUrl / TRANSIT_API_URL variant.+ * Scanned rather than replaced: `/\/+$/` re-walks the slash run from every start+ * position, which is quadratic on a slash-heavy value. Same result, same quirk. */export function stripTrailingSlashes(value: string): string {- return value.replace(/\/+$/, '');+ let end = value.length;+ while (end > 0 && value.charCodeAt(end - 1) === 47 /* '/' */) end--;+ return value.slice(0, end);}const DURATION_UNITS_MS: Record<string, number> = {diff --git a/server/src/nest/atlas/atlas.service.ts b/server/src/nest/atlas/atlas.service.tsindex c740d6969..b80af625b 100644--- a/server/src/nest/atlas/atlas.service.ts+++ b/server/src/nest/atlas/atlas.service.ts@@ -376,7 +376,8 @@ export class AtlasService {const visited = countries.filter((c) => c.status === 'visited');const planned = countries.filter((c) => c.status === 'planned');- const mostVisited = visited.length > 0 ? visited.reduce((a, b) => (a.placeCount > b.placeCount ? a : b)) : null;+ const mostVisited =+ visited.length > 0 ? visited.reduce((a, b) => (a.placeCount > b.placeCount ? a : b), visited[0]) : null;const continents: Record<string, number> = {};visited.forEach((c) => {diff --git a/server/src/nest/auth/auth.helpers.ts b/server/src/nest/auth/auth.helpers.tsindex e3a76811a..fc0457aac 100644--- a/server/src/nest/auth/auth.helpers.ts+++ b/server/src/nest/auth/auth.helpers.ts@@ -16,8 +16,10 @@ import { decrypt_api_key } from '../common/crypto/apiKeyCrypto';// resetPassword and the dummy-hash timing equaliser below — must stay in sync.export const BCRYPT_COST = 12;-// Shape check for email input on register and profile update.-export const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;+// Shape check for email input on register and profile update. The dot is pinned to+// the first one that can split the domain, so the runs on either side of it can+// never claim the same characters. Same strings as before, without backtracking.+export const EMAIL_REGEX = /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/;// Pre-computed bcrypt hash to equalise timing of "unknown email" and// "OIDC-only account" branches with the real verification path (CWE-208).diff --git a/server/src/nest/auth/auth.service.ts b/server/src/nest/auth/auth.service.tsindex f7bfcddc2..a00d1b6eb 100644--- a/server/src/nest/auth/auth.service.ts+++ b/server/src/nest/auth/auth.service.ts@@ -855,8 +855,10 @@ export class AuthService {requestPasswordReset(rawEmail: string, createdIp: string | null): PasswordResetRequestOutcome {const email = String(rawEmail || '').trim().toLowerCase();// Basic shape check — a fully empty / malformed email is treated like- // "no user" so we still spend the same time internally.- const looksLikeEmail = email.length > 0 && /.+@.+\..+/.test(email);+ // "no user" so we still spend the same time internally. Same "[email protected] somewhere+ // on one line" test as the old /.+@.+\..+/, but anchored per line and pinned to+ // the first usable '@' and '.', so a body full of '@' can no longer stall it.+ const looksLikeEmail = email.length > 0 && /^.[^@\r\n\u2028\u2029]*@.[^.\r\n\u2028\u2029]*\../m.test(email);// Global policy check: password login disabled → no reset possible.const toggles = this.resolveAuthToggles();diff --git a/server/src/nest/auth/webauthn-config.service.ts b/server/src/nest/auth/webauthn-config.service.tsindex 831911110..fed212fab 100644--- a/server/src/nest/auth/webauthn-config.service.ts+++ b/server/src/nest/auth/webauthn-config.service.ts@@ -59,7 +59,9 @@ export class WebauthnConfigService {const explicitRpId = (readEnv().webauthn.rpId || this.setting('webauthn_rp_id'))?.trim() || null;const explicitOrigins = (readEnv().webauthn.origins || this.setting('webauthn_origins') || '').split(',')- .map((o) => o.trim().replace(/\/+$/, ''))+ // The lookbehind matches only the first slash of the trailing run. Without it the+ // engine retries from every slash, which is quadratic on a slash-heavy value.+ .map((o) => o.trim().replace(/(?<!\/)\/+$/, '')).filter(Boolean);const appUrl = getAppUrl();@@ -77,7 +79,7 @@ export class WebauthnConfigService {// silently union dev localhost origins into a production allow-list.let origins = explicitOrigins;if (origins.length === 0) {- if (appHost) origins = [appUrl.replace(/\/+$/, '')];+ if (appHost) origins = [appUrl.replace(/(?<!\/)\/+$/, '')];if (rpID === 'localhost') {// Dev: the browser origin is the Vite dev server (:5173), not the API port.origins = Array.from(new Set([...origins, 'http://localhost:5173', 'http://localhost:3001']));diff --git a/server/src/nest/backup/backup.impl.ts b/server/src/nest/backup/backup.impl.tsindex 518ada24b..8d623af4a 100644--- a/server/src/nest/backup/backup.impl.ts+++ b/server/src/nest/backup/backup.impl.ts@@ -239,7 +239,7 @@ export async function createBackup(storage: StorageService, prefix: 'backup' | 'let dbToArchive = dbPath;try {if (fs.existsSync(dbSnap)) fs.rmSync(dbSnap, { force: true });- db.exec(`VACUUM INTO '${dbSnap.replace(/'/g, "''")}'`);+ db.exec(`VACUUM INTO '${dbSnap.replaceAll("'", "''")}'`);dbToArchive = dbSnap;} catch (e) {// Snapshot failed (disk/lock) — fall back to the checkpointed live file ratherdiff --git a/server/src/nest/calendar/calendar.service.ts b/server/src/nest/calendar/calendar.service.tsindex 4dc31f582..39e138faa 100644--- a/server/src/nest/calendar/calendar.service.ts+++ b/server/src/nest/calendar/calendar.service.ts@@ -165,12 +165,12 @@ export class CalendarService {.all(tripId) as any[];const esc = (s: string) => s- .replace(/\\/g, '\\\\')- .replace(/;/g, '\\;')- .replace(/,/g, '\\,')+ .replaceAll(/\\/g, '\\\\')+ .replaceAll(';', '\\;')+ .replaceAll(',', '\\,').replace(/\r?\n/g, '\\n')- .replace(/\r/g, '');- const fmtDate = (d: string) => d.replace(/-/g, '');+ .replaceAll(/\r/g, '');+ const fmtDate = (d: string) => d.replaceAll('-', '');const now = new Date().toISOString().replace(/[-:]/g, '').split('.')[0] + 'Z';const uid = (id: number, type: string) => `trek-${type}-${id}@trek`;@@ -189,7 +189,7 @@ export class CalendarService {// the TZID and leaves a floating time in the feed (#1453 again).if (refDate && d.match(/^\d{2}:\d{2}/)) {const datePart = refDate.split('T')[0];- const raw = `${datePart}T${d.replace(/:/g, '')}`.replace(/-/g, '');+ const raw = `${datePart}T${d.replaceAll(':', '')}`.replaceAll('-', '');return raw.length === 13 ? raw + '00' : raw;}return d.replace(/[-:]/g, '');diff --git a/server/src/nest/common/idempotency.interceptor.ts b/server/src/nest/common/idempotency.interceptor.tsindex f630bc4cb..ff0f0fa40 100644--- a/server/src/nest/common/idempotency.interceptor.ts+++ b/server/src/nest/common/idempotency.interceptor.ts@@ -76,7 +76,7 @@ export class IdempotencyInterceptor implements NestInterceptor {const signature = `${userId}|${req.method}|${req.path}|${key}`;const pending = inFlight.get(signature);- if (pending) {+ if (pending !== undefined) {return from(pending).pipe(switchMap(() => {const stored = this.lookup(key, userId, req);diff --git a/server/src/nest/common/stripHtmlTags.ts b/server/src/nest/common/stripHtmlTags.tsnew file mode 100644index 000000000..03000ef91--- /dev/null+++ b/server/src/nest/common/stripHtmlTags.ts@@ -0,0 +1,44 @@+/**+ * Remove HTML-ish tags from a string, exactly as `/<[^>]+>/g` did.+ *+ * Written as a scan rather than a regex because that pattern backtracks: `[^>]`+ * matches `<` too, so on a run of `<` with no closing `>` the engine retries+ * from every one of them and rescans to the end each time. Measured on a 16k+ * run: 0.52s, and both callers take attacker-supplied text — an uploaded KML+ * description and Wikimedia Commons metadata.+ *+ * The semantics are the regex's, quirks included:+ * - a tag needs at least one character between the brackets, so `<>` is left+ * alone (`[^>]+` is one-or-more);+ * - `<` inside a tag is content, so `<a<b>` is one tag, not two — which is+ * what browsers do with malformed markup, and why narrowing the class to+ * `[^<>]` would have been a behaviour change rather than a fix;+ * - an unterminated `<` at the end is literal text.+ */+export function stripHtmlTags(input: string, replacement = ''): string {+ let out = '';+ let cursor = 0;++ for (;;) {+ const open = input.indexOf('<', cursor);+ if (open === -1) break;++ const close = input.indexOf('>', open + 1);+ // No closing bracket anywhere after: the rest is literal, and this is the+ // case the regex spent quadratic time discovering.+ if (close === -1) break;++ // `<>` — nothing between the brackets, so not a tag. Keep the `<` and carry+ // on from the next character, exactly as the regex's next match attempt would.+ if (close === open + 1) {+ out += input.slice(cursor, open + 1);+ cursor = open + 1;+ continue;+ }++ out += input.slice(cursor, open) + replacement;+ cursor = close + 1;+ }++ return out + input.slice(cursor);+}diff --git a/server/src/nest/feeds/feeds.service.ts b/server/src/nest/feeds/feeds.service.tsindex d3265ac60..9c62a9b90 100644--- a/server/src/nest/feeds/feeds.service.ts+++ b/server/src/nest/feeds/feeds.service.ts@@ -153,7 +153,7 @@ export class FeedsService {.all(user.id, user.id, cutoff) as { id: number }[];const esc = (s: string) =>- s.replace(/\\/g, '\\\\').replace(/;/g, '\\;').replace(/,/g, '\\,').replace(/\r?\n/g, '\\n');+ s.replaceAll('\\', '\\\\').replaceAll(';', '\\;').replaceAll(',', '\\,').replace(/\r?\n/g, '\\n');const calName = `${user.username} – All Trips`;let header = CALENDAR_HEADER;diff --git a/server/src/nest/help/wiki.ts b/server/src/nest/help/wiki.tsindex d35465dba..aa94c0e31 100644--- a/server/src/nest/help/wiki.ts+++ b/server/src/nest/help/wiki.ts@@ -116,7 +116,11 @@ function parseSidebar(md: string): WikiNavSection[] {const sections: WikiNavSection[] = [];let current: WikiNavSection | null = null;for (const raw of md.split('\n')) {- const heading = raw.match(/^#{1,4}\s+(.+?)\s*$/);+ // The title, trimmed: a run that starts and ends on a non-space, or a single+ // character (a heading whose body is only spaces still opens a section, the way+ // `(.+?)\s*$` did). Spelled out so no two quantifiers compete for the same+ // spaces — that pairing backtracks quadratically on a long ragged line.+ const heading = raw.match(/^#{1,4}\s+(\S.*\S|.)\s*$/);if (heading) {current = { title: heading[1].replace(/[*_`]/g, '').trim(), pages: [] };sections.push(current);@@ -151,7 +155,9 @@ function processMarkdown(md: string): string {const hash = anchor ? `#${anchor.trim()}` : '';return `[${title.trim()}](/help/${slug}${hash})`;});- out = out.replace(/!\[([^\]]*)\]\(([^)\s]+)([^)]*)\)/g, (m, alt: string, url: string) => {+ // The optional title after the URL (``) has to start on whitespace,+ // so it cannot compete with the URL group for the same characters.+ out = out.replace(/!\[([^\]]*)\]\(([^)\s]+)(\s[^)]*)?\)/g, (m, alt: string, url: string) => {if (/^https?:\/\//i.test(url) || url.startsWith('/api/help/asset/')) return m;const clean = url.replace(/^\.?\//, '').replace(/^wiki\//, '');return ``;@@ -196,8 +202,9 @@ function outsideCode(md: string, fn: (segment: string) => string): string {}function extractTitle(md: string, fallback: string): string {- const h1 = md.match(/^#\s+(.+?)\s*$/m);- return h1 ? h1[1].replace(/[*_`]/g, '').trim() : fallback.replace(/-/g, ' ');+ // Same shape as the sidebar heading above — see the note there.+ const h1 = md.match(/^#\s+(\S.*\S|.)\s*$/m);+ return h1 ? h1[1].replace(/[*_`]/g, '').trim() : fallback.replaceAll('-', ' ');}export interface WikiPage {diff --git a/server/src/nest/integrations/airtrail.client.ts b/server/src/nest/integrations/airtrail.client.tsindex 80e18235e..e3ed2a208 100644--- a/server/src/nest/integrations/airtrail.client.ts+++ b/server/src/nest/integrations/airtrail.client.ts@@ -154,7 +154,9 @@ export interface AirtrailPassengerWrite {function apiBase(baseUrl: string): string {// Tolerate a pasted trailing slash or '/api' suffix so we never build '/api/api'.- const origin = baseUrl.trim().replace(/\/+$/, '').replace(/\/api$/i, '');+ // The lookbehind matches only the first slash of the trailing run. Without it the+ // engine retries from every slash, which is quadratic on a slash-heavy value.+ const origin = baseUrl.trim().replace(/(?<!\/)\/+$/, '').replace(/\/api$/i, '');return origin + '/api';}diff --git a/server/src/nest/journey/journey-public.controller.ts b/server/src/nest/journey/journey-public.controller.tsindex 7ac6293e4..53fa14e66 100644--- a/server/src/nest/journey/journey-public.controller.ts+++ b/server/src/nest/journey/journey-public.controller.ts@@ -91,7 +91,7 @@ export class JourneyPublicController {{ userId: effectiveOwnerId, ownerId: effectiveOwnerId, assetId },wantThumb,);- if (!streaming) {+ if (streaming === null) {res.status(404).json({ error: 'Provider not supported' });return;}diff --git a/server/src/nest/llm-parse/clients/openai-compatible.client.ts b/server/src/nest/llm-parse/clients/openai-compatible.client.tsindex 39772964e..d965a135a 100644--- a/server/src/nest/llm-parse/clients/openai-compatible.client.ts+++ b/server/src/nest/llm-parse/clients/openai-compatible.client.ts@@ -26,7 +26,9 @@ const MAX_TOKENS = 4096;*/export class OpenAiCompatibleClient implements LlmExtractionClient {async extract(input: LlmExtractionInput): Promise<Record<string, unknown>[]> {- const base = (input.baseUrl ?? 'https://api.openai.com/v1').replace(/\/+$/, '');+ // The lookbehind matches only the first slash of the trailing run. Without it the+ // engine retries from every slash, which is quadratic on a slash-heavy value.+ const base = (input.baseUrl ?? 'https://api.openai.com/v1').replace(/(?<!\/)\/+$/, '');const url = `${base}/chat/completions`;const nuextract = isNuExtractModel(input.model);diff --git a/server/src/nest/llm-parse/llm-local.service.ts b/server/src/nest/llm-parse/llm-local.service.tsindex 095813cb7..b70ee6afb 100644--- a/server/src/nest/llm-parse/llm-local.service.ts+++ b/server/src/nest/llm-parse/llm-local.service.ts@@ -23,7 +23,11 @@ export class LlmLocalService {if (url.protocol !== 'http:' && url.protocol !== 'https:') {throw new HttpException({ error: 'Base URL must be http(s)' }, 400);}- return raw.replace(/\/+$/, '').replace(/\/v1$/, '');+ // Trailing slashes are scanned off instead of `/\/+$/`-replaced: that pattern+ // re-walks the slash run from every start position of the admin-supplied URL.+ let end = raw.length;+ while (end > 0 && raw.charCodeAt(end - 1) === 47 /* '/' */) end--;+ return raw.slice(0, end).replace(/\/v1$/, '');}/** List models already pulled on the local server. */diff --git a/server/src/nest/llm-parse/mime-email.ts b/server/src/nest/llm-parse/mime-email.tsindex e395a6ffb..a6801ae36 100644--- a/server/src/nest/llm-parse/mime-email.ts+++ b/server/src/nest/llm-parse/mime-email.ts@@ -218,10 +218,10 @@ function decodeQuotedPrintable(payload: string): Buffer {for (let i = 0; i < joined.length; i++) {const hex = joined[i] === '=' ? joined.slice(i + 1, i + 3) : '';if (/^[0-9a-fA-F]{2}$/.test(hex)) {- out[len++] = parseInt(hex, 16);+ out[len++] = Number.parseInt(hex, 16);i += 2;} else {- out[len++] = joined.charCodeAt(i) & 0xff;+ out[len++] = joined.codePointAt(i) & 0xff;}}return out.subarray(0, len);@@ -245,7 +245,7 @@ function decodeEncodedWords(value: string): string {return value.replace(/=\?([^?]+)\?([BbQq])\?([^?]*)\?=/g, (whole, charset: string, encoding: string, payload: string) => {const bytes =- encoding.toUpperCase() === 'B' ? decodeBase64(payload) : decodeQuotedPrintable(payload.replace(/_/g, ' '));+ encoding.toUpperCase() === 'B' ? decodeBase64(payload) : decodeQuotedPrintable(payload.replaceAll('_', ' '));const decoded = decodeCharset(bytes, charset);return decoded || whole;})diff --git a/server/src/nest/llm-parse/router/extraction-router.ts b/server/src/nest/llm-parse/router/extraction-router.tsindex c97ff9703..5224e7368 100644--- a/server/src/nest/llm-parse/router/extraction-router.ts+++ b/server/src/nest/llm-parse/router/extraction-router.ts@@ -79,9 +79,12 @@ export function detectFlightNumbers(text: string): string[] {export function extractBookingRef(text: string): string | undefined {// The captured code must contain a digit: real PNRs/booking codes effectively always// do, while the case-insensitive [A-Z0-9] class would otherwise grab a following prose- // word ("Confirmation\nThank you…" → "Thank") after a bare label.+ // word ("Confirmation\nThank you…" → "Thank") after a bare label. The lookahead asserts+ // exactly that (the run's first digit is only ever preceded by letters), and the+ // separator says "spaces, then optionally a colon and more spaces" — both spellings+ // avoid quantifiers that overlap and make document text backtrack.const m = text.match(- /(?:PNR|Buchungs(?:code|nummer|referenz)|Booking\s*(?:reference|code|number)|Confirmation\s*(?:number|code)?|Reservierungsnummer|Reservation\s*(?:No\.?|Number|Nr\.?)|Best(?:ä|ae)tigungs[-\s]?(?:nummer|code)|(?:Expedia[-\s]*)?Reiseplan|Reference)\s*:?\s*((?=[A-Z0-9]*\d)[A-Z0-9]{5,})/i,+ /(?:PNR|Buchungs(?:code|nummer|referenz)|Booking\s*(?:reference|code|number)|Confirmation\s*(?:number|code)?|Reservierungsnummer|Reservation\s*(?:No\.?|Number|Nr\.?)|Best(?:ä|ae)tigungs[-\s]?(?:nummer|code)|(?:Expedia[-\s]*)?Reiseplan|Reference)\s*(?::\s*)?((?=[A-Z]*\d)[A-Z0-9]{5,})/i,);return m?.[1];}@@ -101,12 +104,14 @@ export function extractTotalPrice(text: string): { price: string; currency?: strconst strip = (s: string) => s.replace(/[€$£¥\s]/g, '');// A labeled total: "Gesamtpreis: 1.234,56 €", "Total Amount 99 USD", "Bezahlter Betrag 651,86 €".const labeled = text.match(- /(?:Gesamtpreis|Gesamtbetrag|Gesamtsumme|Total(?:\s*(?:price|amount))?|Amount|Summe|Betrag)\s*:?\s*([€$£¥]?\s*\d[\d.,]*)\s*(EUR|USD|GBP|CHF|JPY|€|\$|£|¥)?/i,+ /(?:Gesamtpreis|Gesamtbetrag|Gesamtsumme|Total(?:\s*(?:price|amount))?|Amount|Summe|Betrag)\s*(?::\s*)?([€$£¥]?\s*\d[\d.,]*)\s*(EUR|USD|GBP|CHF|JPY|€|\$|£|¥)?/i,);if (labeled) return { price: strip(labeled[1]), currency: normCurrency(labeled[2] ?? labeled[1]) };// Fallback: a standalone amount carrying a currency symbol on its own line (e.g. a voucher's- // "¥9,400") — the price sits far from any label the pattern above can anchor to.- const symbol = text.match(/^\s*([€$£¥]\s?\d[\d.,]*)\b/m);+ // "¥9,400") — the price sits far from any label the pattern above can anchor to. The+ // indent is horizontal whitespace only: under /m the anchor already sits at every line+ // start, so a \s* run that could also eat the newlines just re-scans the document.+ const symbol = text.match(/^[^\S\r\n]*([€$£¥]\s?\d[\d.,]*)\b/m);if (symbol) return { price: strip(symbol[1]), currency: normCurrency(symbol[1]) };return null;}diff --git a/server/src/nest/llm-parse/text-extract.ts b/server/src/nest/llm-parse/text-extract.tsindex 397ad94e1..cbb6eb08c 100644--- a/server/src/nest/llm-parse/text-extract.ts+++ b/server/src/nest/llm-parse/text-extract.ts@@ -57,7 +57,7 @@ const HTML_ENTITIES = new Map<string, string>([['larr', '←'],['rarr', '→'],['harr', '↔'],- ...LATIN1_ENTITIES.map((name, i): [string, string] => [name, String.fromCharCode(0xa0 + i)]),+ ...LATIN1_ENTITIES.map((name, i): [string, string] => [name, String.fromCodePoint(0xa0 + i)]),]);function entityCodePoint(code: number): string | null {@@ -85,12 +85,34 @@ function decodeEntities(s: string): string {});}+/**+ * Replace every tag with a space. Hand-rolled rather than a /<[^>]+>/g replace: a+ * match can only start at a "<", so a run of brackets with no ">" behind it — an+ * uploaded .eml or .html is free to carry one — makes the engine rescan the tail+ * once per bracket. Character for character the same result, including the two+ * cases the regex leaves alone: a "<" that nothing closes, and an empty "<>",+ * which [^>]+ cannot match.+ */+function stripTags(s: string): string {+ let out = '';+ let i = 0;+ for (;;) {+ const lt = s.indexOf('<', i);+ if (lt === -1) break;+ const gt = s.indexOf('>', lt + 1);+ if (gt === -1) break; // nothing closes it, so the rest of the string is text+ // An empty "<>" has nothing for [^>]+ to match, so both brackets stay literal.+ out += s.slice(i, lt) + (gt === lt + 1 ? '<>' : ' ');+ i = gt + 1;+ }+ return out + s.slice(i);+}+/** Strip HTML/XML tags, resolve entities and collapse whitespace for a cleaner LLM prompt. */function stripMarkup(s: string): string {- const withoutTags = s- .replace(/<script[\s\S]*?<\/script>/gi, ' ')- .replace(/<style[\s\S]*?<\/style>/gi, ' ')- .replace(/<[^>]+>/g, ' ');+ const withoutTags = stripTags(+ s.replace(/<script[\s\S]*?<\/script>/gi, ' ').replace(/<style[\s\S]*?<\/style>/gi, ' '),+ );// Entities come last so that a decoded `<` cannot turn into a tag the// stripper would then eat.return decodeEntities(withoutTags)@@ -137,6 +159,115 @@ async function extractPdfText(buffer: Buffer): Promise<string> {}}+/** Exactly the code points JS `\s` matches — the class the page-marker pattern walks over. */+const SPACE_CODES = new Set([+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x20, 0xa0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005,+ 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x2028, 0x2029, 0x202f, 0x205f, 0x3000, 0xfeff,+]);++/** The line breaks a multiline `^` starts after and `$` ends before. */+const LINE_END_CODES = new Set([0x0a, 0x0d, 0x2028, 0x2029]);++function isSpaceAt(text: string, i: number): boolean {+ return SPACE_CODES.has(text.charCodeAt(i));+}++function isLineEndAt(text: string, i: number): boolean {+ return LINE_END_CODES.has(text.charCodeAt(i));+}++function isDigitAt(text: string, i: number): boolean {+ const c = text.charCodeAt(i);+ return c >= 0x30 && c <= 0x39;+}++function isDashAt(text: string, i: number): boolean {+ return text.charCodeAt(i) === 0x2d;+}++function skipRun(text: string, from: number, matches: (text: string, i: number) => boolean): number {+ let i = from;+ while (i < text.length && matches(text, i)) i++;+ return i;+}++/**+ * A page marker from its first dash on: `-+\s*\d+\s+of\s+\d+\s*-+\s*$`. Returns+ * where the match ends, or -1 when there is none. Every quantifier in there is+ * followed by a class that excludes what it just matched, so each one can only+ * take its whole run — giving characters back never opens a second way through,+ * which is why one forward pass is enough.+ */+function markerEnd(text: string, dashStart: number): number {+ let i = skipRun(text, skipRun(text, dashStart, isDashAt), isSpaceAt);+ const pageNo = i;+ i = skipRun(text, i, isDigitAt);+ if (i === pageNo) return -1;+ const beforeOf = i;+ i = skipRun(text, i, isSpaceAt);+ if (i === beforeOf) return -1;+ const o = text.charCodeAt(i);+ const f = text.charCodeAt(i + 1);+ if ((o !== 0x6f && o !== 0x4f) || (f !== 0x66 && f !== 0x46)) return -1;+ const afterOf = i + 2;+ i = skipRun(text, afterOf, isSpaceAt);+ if (i === afterOf) return -1;+ const pageCount = i;+ i = skipRun(text, i, isDigitAt);+ if (i === pageCount) return -1;+ const closing = skipRun(text, i, isSpaceAt);+ i = skipRun(text, closing, isDashAt);+ if (i === closing) return -1;+ // `\s*$` hands the trailing run back until `$` sits on a line end; with no+ // line end in it and text still to come, `$` never matches and neither does+ // the marker.+ let lastLineEnd = -1;+ let end = i;+ while (end < text.length && isSpaceAt(text, end)) {+ if (isLineEndAt(text, end)) lastLineEnd = end;+ end++;+ }+ return end === text.length ? end : lastLineEnd;+}++/** The first `^` in `[from, to]` — the earliest position the marker can start at. */+function markerStart(text: string, from: number, to: number): number {+ if (from === 0 || isLineEndAt(text, from - 1)) return from;+ for (let i = from; i < to; i++) if (isLineEndAt(text, i)) return i + 1;+ return -1;+}++/**+ * Drop `-- N of M --` page markers: `/^\s*-+\s*\d+\s+of\s+\d+\s*-+\s*$/gim` as a+ * single left-to-right pass. As a regex it is quadratic — `\s` matches line+ * breaks, so under `m` every line start inside a whitespace run walks that same+ * run again looking for a dash (40k of `" \n"` took ~0.6 s, and this runs first+ * over the raw text layer of an uploaded PDF).+ */+function stripPageMarkers(text: string): string {+ let kept = '';+ let done = 0; // the pattern's lastIndex: nothing before it can match any more+ let i = 0;+ while (i < text.length) {+ const dashStart = text.indexOf('-', i);+ if (dashStart === -1) break;+ // The leading `\s*` reaches back across the whole whitespace run, and the+ // match then starts at the first `^` — string start or line start — in it.+ let runStart = dashStart;+ while (runStart > done && isSpaceAt(text, runStart - 1)) runStart--;+ const start = markerStart(text, runStart, dashStart);+ const end = start === -1 ? -1 : markerEnd(text, dashStart);+ if (end === -1) {+ i = dashStart + 1;+ continue;+ }+ kept += text.slice(done, start);+ done = end;+ i = end;+ }+ return done === 0 ? text : kept + text.slice(done);+}+/*** Clean up pdf-parse output for the LLM:* - strip `-- N of M --` page markers@@ -145,10 +276,9 @@ async function extractPdfText(buffer: Buffer): Promise<string> {* a common PDF kerning artifact that otherwise hides booking fields*/function cleanPdfText(text: string): string {- return text- .replace(/^\s*-+\s*\d+\s+of\s+\d+\s*-+\s*$/gim, '')+ return stripPageMarkers(text).replace(/[ \t]+/g, ' ')- .replace(/\b(?:[A-Z] ){2,}[A-Z]\b/g, m => m.replace(/ /g, ''))+ .replace(/\b(?:[A-Z] ){2,}[A-Z]\b/g, m => m.replaceAll(' ', '')).replace(/ *\n */g, '\n').replace(/\n{3,}/g, '\n\n').trim();diff --git a/server/src/nest/maps/maps.helpers.ts b/server/src/nest/maps/maps.helpers.tsindex 072579bbb..a32bdaa5f 100644--- a/server/src/nest/maps/maps.helpers.ts+++ b/server/src/nest/maps/maps.helpers.ts@@ -1,4 +1,5 @@import { readEnv, getAppUrl } from '../../app-config';+import { stripHtmlTags } from '../common/stripHtmlTags';/*** Pure maps/geo helpers — no DB, no Nest, no side effects beyond reading env.@@ -378,8 +379,12 @@ export function parseOpeningHours(ohString: string): {for (const segment of ohString.split(';')) {const trimmed = segment.trim();if (!trimmed) continue;+ // The time part is `\S.*`, not `.+`: the segment was trimmed above, so both+ // spell "everything after the gap". But `\s+(.+)` lets the gap and the time+ // part fight over the same spaces, and a segment that is a weekday followed by+ // nothing but blanks then costs a pass per space.const match = trimmed.match(- /^((?:Mo|Tu|We|Th|Fr|Sa|Su)(?:\s*-\s*(?:Mo|Tu|We|Th|Fr|Sa|Su))?(?:\s*,\s*(?:Mo|Tu|We|Th|Fr|Sa|Su)(?:\s*-\s*(?:Mo|Tu|We|Th|Fr|Sa|Su))?)*)\s+(.+)$/i,+ /^((?:Mo|Tu|We|Th|Fr|Sa|Su)(?:\s*-\s*(?:Mo|Tu|We|Th|Fr|Sa|Su))?(?:\s*,\s*(?:Mo|Tu|We|Th|Fr|Sa|Su)(?:\s*-\s*(?:Mo|Tu|We|Th|Fr|Sa|Su))?)*)\s+(\S.*)$/i,);if (!match) continue;const [, daysPart, timePart] = match;@@ -489,9 +494,8 @@ export function buildOsmDetails(tags: Record<string, string>, osmType: string, o*/export function stripWikiMarkup(value: string | undefined | null): string | null {if (!value) return null;- const text = value- .replace(/<[^>]+>/g, ' ')- .replace(/ /g, ' ')+ const text = stripHtmlTags(value, ' ')+ .replaceAll(' ', ' ').replace(/\s+/g, ' ').trim();return text || null;@@ -572,7 +576,10 @@ function seriesStem(title: string): string {// 20260614 100717648 HDR — a camera dump, all from the same minute.replace(/\b\d{8}[ _-]\d{6,9}\b/g, ' ').replace(/\b(19|20)\d{2}\b/g, ' ')- .replace(/[ _-]+\(?\d{1,4}\)?$/g, '')+ // The character in front of the suffix is matched and put straight back:+ // /[ _-]+…$/ on its own restarts at every space of a title that has no such+ // suffix, and re-reads the rest of the run each time.+ .replace(/([^ _-]|^)[ _-]+\(?\d{1,4}\)?$/g, '$1').replace(/[^a-z]+/g, ' ').trim();}diff --git a/server/src/nest/maps/maps.service.ts b/server/src/nest/maps/maps.service.tsindex bbd3f3c19..d1da18539 100644--- a/server/src/nest/maps/maps.service.ts+++ b/server/src/nest/maps/maps.service.ts@@ -58,7 +58,10 @@ const PLACES_UPSTREAM = 'https://places.googleapis.com';function placesEndpoint(endpoint: string): string {const base = readEnv().maps.placesApiBase;if (!base || !endpoint.startsWith(PLACES_UPSTREAM)) return endpoint;- return base.replace(/\/+$/, '') + endpoint.slice(PLACES_UPSTREAM.length);+ // The character before the run is matched and written straight back. A bare+ // /\/+$/ restarts at every slash of a base that does not end in one, reading+ // the rest of the run again from each of them.+ return base.replace(/([^/]|^)\/+$/, '$1') + endpoint.slice(PLACES_UPSTREAM.length);}/**@@ -181,7 +184,7 @@ function wikidataImageClaims(claims: WikidataClaims, limit: number): string[] {/** `File:` prefix off, underscores and case normalised — Commons treats these as one title. */function normalizeFileTitle(title: string): string {- return title.replace(/^File:/i, '').replace(/_/g, ' ').trim().toLowerCase();+ return title.replace(/^File:/i, '').replaceAll('_', ' ').trim().toLowerCase();}/**@@ -1851,7 +1854,7 @@ export class MapsService {// Deduplicate concurrent requests for the same placeIdconst existing = this.photoCache.getInFlight(placeId);- if (existing) {+ if (existing !== undefined) {const result = await existing;if (!result) return noPhoto;return { photoUrl: `/api/maps/place-photo/${encodeURIComponent(placeId)}/bytes`, attribution: result.attribution };@@ -1872,7 +1875,7 @@ export class MapsService {// so a place added via search still gets a marker image when Google returns// nothing. Returns null (without marking an error) so the caller decides.const fetchWikimediaFallback = async (): Promise<{ attribution: string | null } | null> => {- if (isNaN(lat) || isNaN(lng)) return null;+ if (Number.isNaN(lat) || Number.isNaN(lng)) return null;try {const wiki = await this.fetchWikimediaPhoto(lat, lng, name);if (!wiki) return null;@@ -2091,10 +2094,10 @@ export class MapsService {let placeName: string | null = null;const placeMatch = resolvedUrl.match(/\/place\/([^/@]+)/);if (placeMatch) {- placeName = decodeURIComponent(placeMatch[1].replace(/\+/g, ' '));+ placeName = decodeURIComponent(placeMatch[1].replaceAll(/\+/g, ' '));}- if (!coords || isNaN(coords.lat) || isNaN(coords.lng)) {+ if (!coords || Number.isNaN(coords.lat) || Number.isNaN(coords.lng)) {throw Object.assign(new Error('Could not extract coordinates from URL'), { status: 400 });}const { lat, lng } = coords;diff --git a/server/src/nest/memories/photo-resolver.service.ts b/server/src/nest/memories/photo-resolver.service.tsindex 142435754..071bf3252 100644--- a/server/src/nest/memories/photo-resolver.service.ts+++ b/server/src/nest/memories/photo-resolver.service.ts@@ -50,7 +50,7 @@ export class PhotoResolverService {if (await this.cache.serveFresh(res, key)) return;const existing = this.cache.getInFlight(key);- if (existing) {+ if (existing !== undefined) {const bytes = await existing;if (bytes && (await this.cache.serveFresh(res, key))) return;await fallback();diff --git a/server/src/nest/notifications/mailer/email-html.ts b/server/src/nest/notifications/mailer/email-html.tsindex e9171f4cd..9fd35e1d6 100644--- a/server/src/nest/notifications/mailer/email-html.ts+++ b/server/src/nest/notifications/mailer/email-html.ts@@ -12,11 +12,11 @@ import type { NotifEventType } from '../notification-events';function escapeHtml(str: string): string {return str- .replace(/&/g, '&')- .replace(/</g, '<')- .replace(/>/g, '>')- .replace(/"/g, '"')- .replace(/'/g, ''');+ .replaceAll('&', '&')+ .replaceAll('<', '<')+ .replaceAll('>', '>')+ .replaceAll('"', '"')+ .replaceAll("'", ''');}// Localized title/body for an event.diff --git a/server/src/nest/notifications/notifications.controller.ts b/server/src/nest/notifications/notifications.controller.tsindex f26c3b924..29c4d4a88 100644--- a/server/src/nest/notifications/notifications.controller.ts+++ b/server/src/nest/notifications/notifications.controller.ts@@ -198,7 +198,7 @@ export class NotificationsController {/** parseInt + the legacy "Invalid id" 400 guard, shared by the /:id handlers. */private parseId(idParam: string): number {const id = Number.parseInt(idParam);- if (isNaN(id)) {+ if (Number.isNaN(id)) {throw new HttpException({ error: 'Invalid id' }, 400);}return id;diff --git a/server/src/nest/notifications/transports/ntfy.service.ts b/server/src/nest/notifications/transports/ntfy.service.tsindex 33905595f..cf76033b4 100644--- a/server/src/nest/notifications/transports/ntfy.service.ts+++ b/server/src/nest/notifications/transports/ntfy.service.ts@@ -38,20 +38,22 @@ const NTFY_DEFAULT_META = { priority: 3 as const, tags: [] as string[] };export function resolveNtfyUrl(adminCfg: NtfyConfig, userCfg: NtfyConfig | null): string | null {const topic = userCfg?.topic;if (!topic) return null;- const base = (userCfg?.server || adminCfg.server || 'https://ntfy.sh').replace(/\/+$/, '');+ // The lookbehind pins the strip to the start of the trailing run. Without it a+ // configured server of nothing but slashes retries from every one of them.+ const base = (userCfg?.server || adminCfg.server || 'https://ntfy.sh').replace(/(?<!\/)\/+$/, '');return `${base}/${encodeURIComponent(topic)}`;}/** Resolve the ntfy POST URL for admin-scoped sends. Returns null if no admin topic. */export function resolveAdminNtfyUrl(adminCfg: NtfyConfig): string | null {if (!adminCfg.topic) return null;- const base = (adminCfg.server || 'https://ntfy.sh').replace(/\/+$/, '');+ const base = (adminCfg.server || 'https://ntfy.sh').replace(/(?<!\/)\/+$/, '');return `${base}/${encodeURIComponent(adminCfg.topic)}`;}function encodeHeaderValue(value: string): string {- for (let i = 0; i < value.length; i++) {- const code = value.charCodeAt(i);+ for (const ch of value) {+ const code = ch.codePointAt(0)!;// Control characters go through the same RFC 2047 wrapper as non-ASCII: a// trip title with a stray newline in it would otherwise be rejected by// undici as an invalid header value and drop the notification silently.diff --git a/server/src/nest/oauth/oauth-public.controller.ts b/server/src/nest/oauth/oauth-public.controller.tsindex a0544ef9c..bd2b425eb 100644--- a/server/src/nest/oauth/oauth-public.controller.ts+++ b/server/src/nest/oauth/oauth-public.controller.ts@@ -9,6 +9,15 @@ import { Public } from '../auth/public.decorator';const MIN = 60_000;+/** Drops every trailing slash from a resource indicator, exactly like the `/\/+$/` replace+ * it stands in for — as a scan, because that pattern re-walks the slash run from every+ * start position of a `resource` value the caller controls. */+function stripTrailingSlashes(value: string): string {+ let end = value.length;+ while (end > 0 && value.charCodeAt(end - 1) === 47 /* '/' */) end--;+ return value.slice(0, end);+}+/*** Public OAuth 2.1 endpoints (no session) — byte-identical to the legacy* oauthPublicRouter (server/src/routes/oauth.ts): MCP-addon gated (404), the@@ -57,7 +66,7 @@ export class OauthPublicController {if (!pending) return invalidGrant('code_invalid_or_expired', null);if (pending.clientId !== client_id) return invalidGrant('client_id_mismatch', pending.userId);if (pending.redirectUri !== redirect_uri) return invalidGrant('redirect_uri_mismatch', pending.userId);- if (pending.resource && resource && pending.resource !== resource.replace(/\/+$/, '')) return invalidGrant('resource_mismatch', pending.userId);+ if (pending.resource && resource && pending.resource !== stripTrailingSlashes(resource)) return invalidGrant('resource_mismatch', pending.userId);if (!this.oauth.authenticateClient(client_id, client_secret)) {logWarn(`[OAuth] Invalid client credentials for client_id=${client_id} ip=${ip ?? '-'}`);this.audit.writeAudit({ userId: pending.userId, action: 'oauth.token.client_auth_failed', details: { client_id }, ip });@@ -116,7 +125,7 @@ export class OauthPublicController {} else {grantedScopes = allowedScopes;}- const audience = resource ? resource.replace(/\/+$/, '') : `${this.oauth.mcpSafeUrl().replace(/\/+$/, '')}/mcp`;+ const audience = resource ? stripTrailingSlashes(resource) : `${stripTrailingSlashes(this.oauth.mcpSafeUrl())}/mcp`;const tokens = this.oauth.issueClientCredentialsToken(client_id, client.user_id, grantedScopes, audience);this.audit.writeAudit({ userId: client.user_id, action: 'oauth.token.issue', details: { client_id, scopes: grantedScopes, audience, grant: 'client_credentials' }, ip });res.json(tokens);diff --git a/server/src/nest/oauth/oauth-sdk.provider.ts b/server/src/nest/oauth/oauth-sdk.provider.tsindex 961832f77..7910025cf 100644--- a/server/src/nest/oauth/oauth-sdk.provider.ts+++ b/server/src/nest/oauth/oauth-sdk.provider.ts@@ -121,8 +121,10 @@ export class TrekOAuthProvider implements OAuthServerProvider {// Redirects browser to the SPA consent page with OAuth params forwarded.async authorize(client: OAuthClientInformationFull, params: AuthorizationParams, res: Response): Promise<void> {- const mcpResource = `${getMcpSafeUrl().replace(/\/+$/, '')}/mcp`;- const resource = params.resource ? params.resource.href.replace(/\/+$/, '') : mcpResource;+ // The lookbehind matches only the first slash of the trailing run. Without it the+ // engine retries from every slash, which is quadratic on a slash-heavy value.+ const mcpResource = `${getMcpSafeUrl().replace(/(?<!\/)\/+$/, '')}/mcp`;+ const resource = params.resource ? params.resource.href.replace(/(?<!\/)\/+$/, '') : mcpResource;if (resource !== mcpResource) {const url = new URL(params.redirectUri);@@ -143,7 +145,7 @@ export class TrekOAuthProvider implements OAuthServerProvider {if (params.state) qs.set('state', params.state);if (params.resource) qs.set('resource', params.resource.href);- const base = getMcpSafeUrl().replace(/\/+$/, '');+ const base = getMcpSafeUrl().replace(/(?<!\/)\/+$/, '');res.redirect(302, `${base}/oauth/consent?${qs.toString()}`);}@@ -169,7 +171,7 @@ export class TrekOAuthProvider implements OAuthServerProvider {if (redirectUri && pending.redirectUri !== redirectUri)throw new Error('Authorization grant is invalid.');- const resourceStr = resource ? resource.href.replace(/\/+$/, '') : null;+ const resourceStr = resource ? resource.href.replace(/(?<!\/)\/+$/, '') : null;if (pending.resource && resourceStr && pending.resource !== resourceStr)throw new Error('Authorization grant is invalid.');diff --git a/server/src/nest/oauth/oauth.service.ts b/server/src/nest/oauth/oauth.service.tsindex b1f2e32e9..98f3e76de 100644--- a/server/src/nest/oauth/oauth.service.ts+++ b/server/src/nest/oauth/oauth.service.ts@@ -624,9 +624,11 @@ export class OauthService {// bind the token to the MCP endpoint by default — previously this// left `audience = null`, and the audience-bind check on MCP requests// then treated a null audience as "valid for any resource".- const mcpResource = `${getMcpSafeUrl().replace(/\/+$/, '')}/mcp`;+ // The lookbehind matches only the first slash of the trailing run. Without it the+ // engine retries from every slash, which is quadratic on a slash-heavy value.+ const mcpResource = `${getMcpSafeUrl().replace(/(?<!\/)\/+$/, '')}/mcp`;const resource = params.resource- ? params.resource.replace(/\/+$/, '')+ ? params.resource.replace(/(?<!\/)\/+$/, ''): mcpResource;if (resource !== mcpResource) {return { valid: false, error: 'invalid_target', error_description: 'Requested resource must be the TREK MCP endpoint' };diff --git a/server/src/nest/oidc/oidc.service.ts b/server/src/nest/oidc/oidc.service.tsindex c68a505d9..8263f0f25 100644--- a/server/src/nest/oidc/oidc.service.ts+++ b/server/src/nest/oidc/oidc.service.ts@@ -84,7 +84,7 @@ type JwksEntry = { keys: Array<Record<string, unknown>>; fetchedAt: number };// ---------------------------------------------------------------------------function base64url(buf: Buffer): string {- return buf.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');+ return buf.toString('base64url');}const isRecord = (v: unknown): v is Record<string, unknown> =>@@ -120,7 +120,7 @@ interface InviteTokenRow {}function base64UrlDecode(input: string): Buffer {- const padded = input.replace(/-/g, '+').replace(/_/g, '/') + '='.repeat((4 - (input.length % 4)) % 4);+ const padded = input.replaceAll('-', '+').replaceAll('_', '/') + '='.repeat((4 - (input.length % 4)) % 4);return Buffer.from(padded, 'base64');}@@ -259,7 +259,9 @@ export class OidcService implements OnModuleDestroy {const discoveryUrl = oidcEnv.discoveryUrl || get('oidc_discovery_url') || null;if (!issuer || !clientId || !clientSecret) return null;- return { issuer: issuer.replace(/\/+$/, ''), clientId, clientSecret, displayName, discoveryUrl };+ // The lookbehind pins the trailing-slash strip (here and below) to the start of+ // the run — without it an issuer of nothing but slashes retries from every one.+ return { issuer: issuer.replace(/(?<!\/)\/+$/, ''), clientId, clientSecret, displayName, discoveryUrl };}// -------------------------------------------------------------------------@@ -283,7 +285,7 @@ export class OidcService implements OnModuleDestroy {// and we reject. When the operator explicitly overrides the discovery URL (e.g.// Authentik realm paths), the discovery doc's issuer is the canonical value —// trust it and warn rather than blocking login.- const docIssuer = doc.issuer?.replace(/\/+$/, '') ?? '';+ const docIssuer = doc.issuer?.replace(/(?<!\/)\/+$/, '') ?? '';if (docIssuer && docIssuer !== issuer) {if (discoveryUrl) {console.warn(@@ -480,7 +482,7 @@ export class OidcService implements OnModuleDestroy {// Normalize trailing slash before issuer comparison — some IdPs (e.g. Authentik)// include a trailing slash in the id_token iss claim.- const tokenIssuer = typeof claims['iss'] === 'string' ? claims['iss'].replace(/\/+$/, '') : '';+ const tokenIssuer = typeof claims['iss'] === 'string' ? claims['iss'].replace(/(?<!\/)\/+$/, '') : '';if (tokenIssuer !== expectedIssuer) {return { ok: false, error: `signature_or_claim_mismatch: jwt issuer invalid. expected: ${expectedIssuer}` };}diff --git a/server/src/nest/place-enrichment/place-enrichment.service.ts b/server/src/nest/place-enrichment/place-enrichment.service.tsindex 4aa5a2acb..ada4d3e9b 100644--- a/server/src/nest/place-enrichment/place-enrichment.service.ts+++ b/server/src/nest/place-enrichment/place-enrichment.service.ts@@ -172,7 +172,7 @@ export function collectFacts(details: Record<string, unknown> | null): PlaceFactconst cuisine = typeof details.cuisine === 'string' ? details.cuisine : null;// OSM writes several cuisines semicolon-separated and underscored.- if (cuisine) push('cuisine', cuisine.split(';').map((c) => c.replace(/_/g, ' ').trim()).filter(Boolean).join(', '));+ if (cuisine) push('cuisine', cuisine.split(';').map((c) => c.replaceAll('_', ' ').trim()).filter(Boolean).join(', '));// `menu_url` is a community-editable OSM tag that becomes an href on the// client, so it goes through the same allow-list as a place's website —diff --git a/server/src/nest/places/gpx-export.helpers.ts b/server/src/nest/places/gpx-export.helpers.tsindex 46c3dffc6..d9fce662c 100644Binary files a/server/src/nest/places/gpx-export.helpers.ts and b/server/src/nest/places/gpx-export.helpers.ts differdiff --git a/server/src/nest/places/kml-import.helpers.ts b/server/src/nest/places/kml-import.helpers.tsindex 4f0373bd9..f6d7f3812 100644--- a/server/src/nest/places/kml-import.helpers.ts+++ b/server/src/nest/places/kml-import.helpers.ts@@ -1,4 +1,5 @@import { TextDecoder } from 'util';+import { stripHtmlTags } from '../common/stripHtmlTags';export interface ParsedKmlPlacemark {name: string | null;@@ -83,14 +84,14 @@ export function sanitizeKmlDescription(value: unknown): string | null {// Unwrap CDATA sections — present when fast-xml-parser returns raw node text// via stopNodes. Must happen before tag-stripping so the CDATA markers are- // not mis-parsed by the <[^>]+> regex.+ // not mis-parsed as tags.const withoutCdata = raw.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, '$1');const withLineBreaks = withoutCdata.replace(/<br\s*\/?>/gi, '\n');- const stripped = withLineBreaks.replace(/<[^>]+>/g, '');+ const stripped = stripHtmlTags(withLineBreaks);const decoded = decodeHtmlEntities(stripped)- .replace(/\r\n/g, '\n')- .replace(/\r/g, '\n')+ .replaceAll('\r\n', '\n')+ .replaceAll('\r', '\n').replace(/[\t\f\v]+/g, ' ').replace(/\n{3,}/g, '\n\n').trim();diff --git a/server/src/nest/places/places.service.ts b/server/src/nest/places/places.service.tsindex 8fa1e82fd..eb8e3b25b 100644--- a/server/src/nest/places/places.service.ts+++ b/server/src/nest/places/places.service.ts@@ -623,7 +623,7 @@ export class PlacesService {if (!gpx) return null;const str = (v: unknown) => (v != null ? String(v).trim() : null);- const num = (v: unknown) => { const n = Number.parseFloat(String(v)); return isNaN(n) ? null : n; };+ const num = (v: unknown) => { const n = Number.parseFloat(String(v)); return Number.isNaN(n) ? null : n; };// Routes and tracks rarely carry their own <name>. Without one they all fall back to the// same generic label, so name-based dedup drops every import after the first. Derive a@@ -980,7 +980,7 @@ export class PlacesService {const name = item?.[2];const note = item?.[3] || null;- if (name && typeof lat === 'number' && typeof lng === 'number' && !isNaN(lat) && !isNaN(lng)) {+ if (name && typeof lat === 'number' && typeof lng === 'number' && !Number.isNaN(lat) && !Number.isNaN(lng)) {places.push({ name, lat, lng, notes: note || null, googleFtid: googleMapsFeatureIdFromItem(item) });}}diff --git a/server/src/nest/plugins/host/plugin-data.service.ts b/server/src/nest/plugins/host/plugin-data.service.tsindex 858f9b86b..ae798e466 100644--- a/server/src/nest/plugins/host/plugin-data.service.ts+++ b/server/src/nest/plugins/host/plugin-data.service.ts@@ -181,7 +181,7 @@ export class PluginDataDb {* FORBIDDEN guard by design. */snapshotInto(destPath: string): void {fs.rmSync(destPath, { force: true }); // VACUUM INTO fails if the target already exists- this.db.exec(`VACUUM INTO '${destPath.replace(/'/g, "''")}'`);+ this.db.exec(`VACUUM INTO '${destPath.replaceAll("'", "''")}'`);}close(): void {diff --git a/server/src/nest/plugins/install/manifest.ts b/server/src/nest/plugins/install/manifest.tsindex 7b0872130..10efe2072 100644--- a/server/src/nest/plugins/install/manifest.ts+++ b/server/src/nest/plugins/install/manifest.ts@@ -148,7 +148,7 @@ export class ManifestError extends Error {}/** JSON.parse that tolerates a UTF-8 BOM (0xFEFF) — manifests written on Windows often carry one. */export function parseJsonText(text: string): unknown {- return JSON.parse(text.charCodeAt(0) === 0xfeff ? text.slice(1) : text);+ return JSON.parse(text.codePointAt(0) === 0xfeff ? text.slice(1) : text);}/**diff --git a/server/src/nest/plugins/install/safe-extract.ts b/server/src/nest/plugins/install/safe-extract.tsindex 93dae2b68..5c3429001 100644--- a/server/src/nest/plugins/install/safe-extract.ts+++ b/server/src/nest/plugins/install/safe-extract.ts@@ -28,7 +28,7 @@ export class ExtractError extends Error {}/** Assert a member path stays within dest; return the safe absolute path. */export function safeJoin(dest: string, name: string): string {- const norm = name.replace(/\\/g, '/');+ const norm = name.replaceAll(/\\/g, '/');if (norm.startsWith('/') || /^[a-zA-Z]:/.test(norm)) throw new ExtractError(`absolute path rejected: ${name}`);if (norm.split('/').some((seg) => seg === '..')) throw new ExtractError(`path traversal rejected: ${name}`);const resolved = path.resolve(dest, norm);@@ -92,7 +92,7 @@ function readTarGz(buf: Buffer, lim: Required<ExtractLimits>): Member[] {if (!Number.isSafeInteger(size) || size < 0) {throw new ExtractError(`invalid entry size in tar header: ${block.subarray(124, 136).toString('utf8').replace(/\0.*$/, '').trim()}`);}- const typeflag = String.fromCharCode(block[156]);+ const typeflag = String.fromCodePoint(block[156]);off += 512;const data = tar.subarray(off, off + size);off += Math.ceil(size / 512) * 512;diff --git a/server/src/nest/plugins/install/safe-fetch.ts b/server/src/nest/plugins/install/safe-fetch.tsindex f3f93952d..b38aecf93 100644--- a/server/src/nest/plugins/install/safe-fetch.ts+++ b/server/src/nest/plugins/install/safe-fetch.ts@@ -99,6 +99,6 @@ async function readCapped(resp: Response, maxBytes: number): Promise<Buffer> {export function sha256Matches(actual: string, expected: string): boolean {if (actual.length !== expected.length) return false;let diff = 0;- for (let i = 0; i < actual.length; i++) diff |= actual.charCodeAt(i) ^ expected.charCodeAt(i);+ for (let i = 0; i < actual.length; i++) diff |= (actual.codePointAt(i) ?? 0) ^ (expected.codePointAt(i) ?? 0);return diff === 0;}diff --git a/server/src/nest/plugins/oauth/plugin-oauth.service.ts b/server/src/nest/plugins/oauth/plugin-oauth.service.tsindex 2d2716e6a..c1e658ba4 100644--- a/server/src/nest/plugins/oauth/plugin-oauth.service.ts+++ b/server/src/nest/plugins/oauth/plugin-oauth.service.ts@@ -32,7 +32,7 @@ const STATE_TTL_MS = 10 * 60 * 1000; // an authorize round-trip must finish withconst REFRESH_SKEW_S = 60; // refresh a token expiring within a minutefunction b64url(buf: Buffer): string {- return buf.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');+ return buf.toString('base64url');}/** Cheap fast-fail for an obviously-internal token endpoint. This is a pre-check, not thediff --git a/server/src/nest/plugins/plugin-runtime.service.ts b/server/src/nest/plugins/plugin-runtime.service.tsindex b0e8bb138..8a1687b63 100644--- a/server/src/nest/plugins/plugin-runtime.service.ts+++ b/server/src/nest/plugins/plugin-runtime.service.ts@@ -313,7 +313,7 @@ export class PluginRuntimeService implements OnApplicationBootstrap, OnModuleDes// a drain, and a pass awaits per-row delivery (up to the invoke timeout each), so// running two concurrently would select the SAME rows and deliver an erasure twice.// A caller that awaits still waits for a full pass (the in-flight one).- if (this.drainInFlight) return this.drainInFlight;+ if (this.drainInFlight !== null) return this.drainInFlight;this.drainInFlight = this.runDrainOnce().finally(() => { this.drainInFlight = null; });return this.drainInFlight;}diff --git a/server/src/nest/plugins/runtime/egress-policy.ts b/server/src/nest/plugins/runtime/egress-policy.tsindex f9cc3ac14..fe0f70eab 100644--- a/server/src/nest/plugins/runtime/egress-policy.ts+++ b/server/src/nest/plugins/runtime/egress-policy.ts@@ -69,7 +69,10 @@ function embeddedTransitionIpv4(g: number[]): string | null {/** Expand an IPv6 literal into its 8 numeric hextets, or null if not a valid IPv6. */function expandV6(ip: string): number[] | null {- let h = ip.toLowerCase().replace(/%.*$/, '');+ // Cut the zone id off (`fe80::1%eth0`): indexOf rather than a `%.*$` regex, whose+ // greedy tail rescans the whole string once per `%` on a host that never matches.+ const zone = ip.indexOf('%');+ let h = (zone === -1 ? ip : ip.slice(0, zone)).toLowerCase();if (!h.includes(':')) return null;const dotted = h.match(/^(.*:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);if (dotted) {@@ -82,7 +85,7 @@ function expandV6(ip: string): number[] | null {const head = halves[0] ? halves[0].split(':') : [];const tail = halves.length === 2 && halves[1] ? halves[1].split(':') : [];const groups =- halves.length === 2 ? [...head, ...Array(8 - head.length - tail.length).fill('0'), ...tail] : head;+ halves.length === 2 ? [...head, ...new Array(8 - head.length - tail.length).fill('0'), ...tail] : head;if (groups.length !== 8) return null;const nums = groups.map((x) => (x === '' ? Number.NaN : Number.parseInt(x, 16)));return nums.some((n) => !Number.isInteger(n) || n < 0 || n > 0xffff) ? null : nums;diff --git a/server/src/nest/plugins/text-sanitize.ts b/server/src/nest/plugins/text-sanitize.tsindex d80b51c44..b0eaabb64 100644--- a/server/src/nest/plugins/text-sanitize.ts+++ b/server/src/nest/plugins/text-sanitize.ts@@ -26,9 +26,12 @@ export function stripEmoji(s: string): string {const stripped = s.replace(EMOJI_RE, '');// Nothing removed → return verbatim so a plain string keeps its exact spacing and// paragraph breaks (matters for PDF paragraphs). Otherwise collapse only the- // horizontal gaps an emoji left, never newlines.+ // horizontal gaps an emoji left, never newlines. The trailing-space trim carries the+ // char in front of the run (or the line start) into the match and puts it back, so the+ // run is only ever walked from its own start — plugin text must not make ` +$` restart+ // inside every space of a long one.if (stripped === s) return s;- return stripped.replace(/[^\S\r\n]{2,}/g, ' ').replace(/ +$/gm, '').trim();+ return stripped.replace(/[^\S\r\n]{2,}/g, ' ').replace(/(^|[^ ]) +$/gm, '$1').trim();}/** True if the string contains at least one emoji — used by the dev/validate warnings. */diff --git a/server/src/nest/storage/drivers/s3.driver.ts b/server/src/nest/storage/drivers/s3.driver.tsindex 6d17bede8..b24a2ce81 100644--- a/server/src/nest/storage/drivers/s3.driver.ts+++ b/server/src/nest/storage/drivers/s3.driver.ts@@ -465,11 +465,17 @@ export class S3Driver implements StorageDriver {/*** '' stays ''; anything else becomes one or more slash-joined segments with a* trailing slash, or throws StorageInvalidKeyError. app-config/env.ts's- * s3Preconditions validates the same slash-stripped shape at boot — keep the- * two strip-regexes identical (`/^\/+|\/+$/g`).+ * s3Preconditions validates the same slash-stripped shape at boot — keep the two+ * strips identical: leading AND trailing slash runs removed, as `/^\/+|\/+$/g` did.+ * Scanned rather than replaced, because that pattern re-walks the trailing run from+ * every start position.*/function normalizeKeyPrefix(raw: string): string {- const trimmed = raw.replace(/^\/+|\/+$/g, '');+ let start = 0;+ let end = raw.length;+ while (start < end && raw.charCodeAt(start) === 47 /* '/' */) start++;+ while (end > start && raw.charCodeAt(end - 1) === 47) end--;+ const trimmed = raw.slice(start, end);if (trimmed === '') return '';assertValidPrefix(`${trimmed}/`);return `${trimmed}/`;diff --git a/server/src/nest/storage/storage-keys.ts b/server/src/nest/storage/storage-keys.tsindex 32bb7a5ce..0b56a0ef0 100644--- a/server/src/nest/storage/storage-keys.ts+++ b/server/src/nest/storage/storage-keys.ts@@ -17,8 +17,8 @@ import { StorageInvalidKeyError } from './storage.types';const MAX_KEY_LENGTH = 1024;function hasControlChars(value: string): boolean {- for (let i = 0; i < value.length; i++) {- const code = value.charCodeAt(i);+ for (const char of value) {+ const code = char.codePointAt(0) as number;if (code < 0x20 || code === 0x7f) return true;}return false;diff --git a/server/src/nest/transit/transit.service.ts b/server/src/nest/transit/transit.service.tsindex 7e05d4c0a..beff0957c 100644--- a/server/src/nest/transit/transit.service.ts+++ b/server/src/nest/transit/transit.service.ts@@ -190,7 +190,7 @@ export class TransitService {if (q.time) {const parsed = new Date(q.time);- if (isNaN(parsed.getTime())) bad('time must be an ISO date-time');+ if (Number.isNaN(parsed.getTime())) bad('time must be an ISO date-time');params.set('time', parsed.toISOString());}if (q.arriveBy) params.set('arriveBy', 'true');diff --git a/server/src/nest/trips/trips.mcp.ts b/server/src/nest/trips/trips.mcp.tsindex ee2057904..e9af810f9 100644--- a/server/src/nest/trips/trips.mcp.ts+++ b/server/src/nest/trips/trips.mcp.ts@@ -100,12 +100,12 @@ export class TripsMcp {if (this.auth.isDemoUser(ctx.userId)) return demoDenied();if (start_date) {const d = new Date(start_date + 'T00:00:00Z');- if (isNaN(d.getTime()) || d.toISOString().slice(0, 10) !== start_date)+ if (Number.isNaN(d.getTime()) || d.toISOString().slice(0, 10) !== start_date)return { content: [{ type: 'text' as const, text: 'start_date is not a valid calendar date.' }], isError: true };}if (end_date) {const d = new Date(end_date + 'T00:00:00Z');- if (isNaN(d.getTime()) || d.toISOString().slice(0, 10) !== end_date)+ if (Number.isNaN(d.getTime()) || d.toISOString().slice(0, 10) !== end_date)return { content: [{ type: 'text' as const, text: 'end_date is not a valid calendar date.' }], isError: true };}if (start_date && end_date && new Date(end_date) < new Date(start_date)) {@@ -145,12 +145,12 @@ export class TripsMcp {if (!this.guards.hasTripPermission('trip_edit', tripId, ctx.userId)) return permissionDenied();if (start_date) {const d = new Date(start_date + 'T00:00:00Z');- if (isNaN(d.getTime()) || d.toISOString().slice(0, 10) !== start_date)+ if (Number.isNaN(d.getTime()) || d.toISOString().slice(0, 10) !== start_date)return { content: [{ type: 'text' as const, text: 'start_date is not a valid calendar date.' }], isError: true };}if (end_date) {const d = new Date(end_date + 'T00:00:00Z');- if (isNaN(d.getTime()) || d.toISOString().slice(0, 10) !== end_date)+ if (Number.isNaN(d.getTime()) || d.toISOString().slice(0, 10) !== end_date)return { content: [{ type: 'text' as const, text: 'end_date is not a valid calendar date.' }], isError: true };}// update() re-anchors the budget before the trip row moves off the olddiff --git a/server/src/nest/weather/weather.impl.ts b/server/src/nest/weather/weather.impl.tsindex 613c8bffc..2ba7a86a8 100644--- a/server/src/nest/weather/weather.impl.ts+++ b/server/src/nest/weather/weather.impl.ts@@ -430,7 +430,7 @@ export async function getWeather(const inFlightKey = `${ck}:${lang}`;const existing = inFlight.get(inFlightKey);- if (existing) return existing;+ if (existing !== undefined) return existing;const promise = _getWeatherImpl(lat, lng, date, lang, time);inFlight.set(inFlightKey, promise);try { return await promise; } finally { inFlight.delete(inFlightKey); }@@ -601,7 +601,7 @@ export async function getDetailedWeather(const inFlightKey = `${ck}:${lang}`;const existing = inFlight.get(inFlightKey);- if (existing) return existing;+ if (existing !== undefined) return existing;const promise = _getDetailedWeatherImpl(lat, lng, date, lang);inFlight.set(inFlightKey, promise);try { return await promise; } finally { inFlight.delete(inFlightKey); }diff --git a/server/src/utils/ipv6.ts b/server/src/utils/ipv6.tsindex 97fd4bb72..afa8bbf81 100644--- a/server/src/utils/ipv6.ts+++ b/server/src/utils/ipv6.ts@@ -12,7 +12,10 @@/** Expand an IPv6 literal into its 8 numeric hextets, or null if not a valid IPv6. */export function expandIpv6(ip: string): number[] | null {- let h = ip.toLowerCase().replace(/%.*$/, '');+ // Cut the zone id off (`fe80::1%eth0`): indexOf rather than a `%.*$` regex, whose+ // greedy tail rescans the whole string once per `%` on a host that never matches.+ const zone = ip.indexOf('%');+ let h = (zone === -1 ? ip : ip.slice(0, zone)).toLowerCase();if (!h.includes(':')) return null;const dotted = h.match(/^(.*:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);if (dotted) {@@ -25,7 +28,7 @@ export function expandIpv6(ip: string): number[] | null {const head = halves[0] ? halves[0].split(':') : [];const tail = halves.length === 2 && halves[1] ? halves[1].split(':') : [];const groups =- halves.length === 2 ? [...head, ...Array(8 - head.length - tail.length).fill('0'), ...tail] : head;+ halves.length === 2 ? [...head, ...new Array(8 - head.length - tail.length).fill('0'), ...tail] : head;if (groups.length !== 8) return null;const nums = groups.map((x) => (x === '' ? Number.NaN : Number.parseInt(x, 16)));return nums.some((n) => !Number.isInteger(n) || n < 0 || n > 0xffff) ? null : nums;diff --git a/server/tests/unit/nest/strip-html-tags.test.ts b/server/tests/unit/nest/strip-html-tags.test.tsnew file mode 100644index 000000000..1950576f3--- /dev/null+++ b/server/tests/unit/nest/strip-html-tags.test.ts@@ -0,0 +1,72 @@+/**+ * stripHtmlTags replaced `/<[^>]+>/g` on two attacker-reachable paths (an+ * uploaded KML description, Wikimedia Commons metadata), where that pattern+ * backtracks: `[^>]` matches `<` as well, so a run of `<` with no closing+ * bracket is retried from every one of them.+ *+ * The contract is "identical output to the regex, including its quirks", so the+ * cases below are written against the regex rather than against what a tidy tag+ * stripper would do.+ */+import { describe, it, expect } from 'vitest';+import { stripHtmlTags } from '../../../src/nest/common/stripHtmlTags';++/** The pattern this function replaced — the oracle for every case here. */+const oracle = (s: string, repl = '') => s.replace(/<[^>]+>/g, repl);++describe('stripHtmlTags', () => {+ it('STRIP-001: removes ordinary tags and keeps the text between them', () => {+ expect(stripHtmlTags('<b>bold</b> and <i>it</i>')).toBe('bold and it');+ });++ it('STRIP-002: substitutes the replacement string when one is given', () => {+ expect(stripHtmlTags('<a href="x">link</a>', ' ')).toBe(' link ');+ });++ it('STRIP-003: leaves text with no tags untouched', () => {+ expect(stripHtmlTags('plain text, 3 < 4 and nothing else')).toBe('plain text, 3 < 4 and nothing else');+ });++ it('STRIP-004: leaves `<>` alone, because the pattern needs a character between the brackets', () => {+ expect(stripHtmlTags('a<>b')).toBe('a<>b');+ expect(stripHtmlTags('a<>b')).toBe(oracle('a<>b'));+ });++ it('STRIP-005: treats `<` inside a tag as content, the way a browser does', () => {+ // Narrowing the class to [^<>] would make this two tags and leave "<a" behind.+ expect(stripHtmlTags('<a<b>x')).toBe('x');+ expect(stripHtmlTags('<a<b>x')).toBe(oracle('<a<b>x'));+ });++ it('STRIP-006: keeps an unterminated `<` as literal text', () => {+ expect(stripHtmlTags('text <not closed')).toBe('text <not closed');+ });++ it('STRIP-007: spans newlines inside a tag', () => {+ expect(stripHtmlTags('<div\n class="x">y</div>')).toBe('y');+ });++ it('STRIP-008: matches the regex on every string over `<>ab \\n` up to length 6', () => {+ const alphabet = ['<', '>', 'a', 'b', ' ', '\n'];+ let compared = 0;+ const walk = (prefix: string, depth: number) => {+ for (const repl of ['', ' ']) {+ expect(stripHtmlTags(prefix, repl), JSON.stringify(prefix)).toBe(oracle(prefix, repl));+ compared++;+ }+ if (depth === 0) return;+ for (const c of alphabet) walk(prefix + c, depth - 1);+ };+ walk('', 6);+ expect(compared).toBeGreaterThan(100_000);+ });++ it('STRIP-009: stays linear on the input the regex went quadratic on', () => {+ // 40k '<' with no '>': the regex restarted at every one and rescanned to the+ // end, ~0.9s. A generous bound — the point is the shape, not the machine.+ const evil = '<'.repeat(40_000);+ const started = Date.now();+ expect(stripHtmlTags(evil)).toBe(evil);+ expect(Date.now() - started).toBeLessThan(500);+ });+});diff --git a/sonar-project.properties b/sonar-project.propertiesindex de8af18c0..9ac715f1f 100644--- a/sonar-project.properties+++ b/sonar-project.properties@@ -62,7 +62,7 @@ sonar.cpd.exclusions=shared/src/i18n/**# Locale files are UI copy — strings like "Password", "API key", "token" are labels,# not credentials, and the secret detectors false-positive on them constantly.# Ignore the secrets analyzer and the hard-coded-credential rules on i18n only.-sonar.issue.ignore.multicriteria=i18nsec1,i18nsec2,i18nsec3,rand1,rand2,rand3,rand4,rand5,rand6,cli1,hash1,hash2,hash3,hash4,hash5,hash6,hash7,hash8,ns1,ns2,frame1+sonar.issue.ignore.multicriteria=i18nsec1,i18nsec2,i18nsec3,rand1,rand2,rand3,rand4,rand5,rand6,cli1,hash1,hash2,hash3,hash4,hash5,hash6,hash7,hash8,ns1,ns2,frame1,empty1,empty2,canvas1,wiki1,tar1sonar.issue.ignore.multicriteria.i18nsec1.ruleKey=secrets:*sonar.issue.ignore.multicriteria.i18nsec1.resourceKey=shared/src/i18n/**sonar.issue.ignore.multicriteria.i18nsec2.ruleKey=typescript:S2068@@ -176,3 +176,52 @@ sonar.issue.ignore.multicriteria.hash7.ruleKey=typescript:S7767sonar.issue.ignore.multicriteria.hash7.resourceKey=client/src/components/Budget/BudgetPanel.helpers.tssonar.issue.ignore.multicriteria.hash8.ruleKey=typescript:S7767sonar.issue.ignore.multicriteria.hash8.resourceKey=client/src/components/Planner/TravelerPicker.tsx++# S4158 (empty collection accessed) — two places where the analyser cannot see+# who fills the collection, and where acting on it would delete working code.+#+# mcp/sessionManager declares `export const sessions = new Map()` and never+# writes to it in that file; every insert comes from+# nest/mcp-transport/mcp-transport.service.ts. The four findings are the eviction+# loop, the two revocation loops and the per-user cap scan — so "removing the+# dead code" would leak every MCP session and leave a revoked OAuth client with+# live ones. It is only ever empty at process start.+sonar.issue.ignore.multicriteria.empty1.ruleKey=typescript:S4158+sonar.issue.ignore.multicriteria.empty1.resourceKey=server/src/mcp/sessionManager.ts+# client/src/managed is a build-time seam: the arrays are empty in this repo and+# in every build of it, and an operator shipping extra screens replaces the file.+# Its header comment makes reading them unconditionally a rule, so the public+# build takes the same code path as a managed one.+sonar.issue.ignore.multicriteria.empty2.ruleKey=typescript:S4158+sonar.issue.ignore.multicriteria.empty2.resourceKey=client/src/managed/**++# S8786 (non-linear backtracking) on the wiki renderer — the two link patterns+# have NO overlapping quantifier pair: each `[^\]]+` / `[^)\s]+` is followed by a+# literal its own class excludes, and they are separated by `](`. What is+# quadratic is only the unanchored global scan over a long run of `[`, and the+# way to stop that is to exclude `[` from the link-text class — which would stop+# `[see [1]](url)` being rewritten at all. The subject is not user input either:+# the content is the `wiki/**` directory shipped with the app, the same files CI+# mirrors to the public GitHub wiki. Changing link parsing to satisfy a rule+# about untrusted input, on input that is not untrusted, is the wrong trade.+sonar.issue.ignore.multicriteria.wiki1.ruleKey=typescript:S8786+sonar.issue.ignore.multicriteria.wiki1.resourceKey=server/src/nest/help/wiki.ts+# S8786 on the tar reader — `/\0.*$/` trims the NUL padding out of a header+# field, and it does backtrack, but the subject is a fixed-size slice the tar+# format defines: 100 bytes for the name, 155 for the prefix, 12 for the size.+# The quadratic factor is bounded at ~10^4 character comparisons per member and+# an attacker cannot grow it. The rewrite that would clear the rule+# (`\0[^\0\n\r]*$`) stops matching NUL runs, which changes what gets truncated on+# the path-traversal guard — not a trade worth making for a lint finding. The two+# tag strippers that WERE reachable (uploaded KML, Commons metadata) were fixed+# instead, in common/stripHtmlTags.ts.+sonar.issue.ignore.multicriteria.tar1.ruleKey=typescript:S8786+sonar.issue.ignore.multicriteria.tar1.resourceKey=server/src/nest/plugins/install/safe-extract.ts++# S6825 on LoginWorld — the element is a decorative animated background:+# <canvas aria-hidden pointer-events:none>, no tabIndex, no children, no role.+# aria-hidden is the correct markup for it. Both ways to satisfy the rule make+# things worse: dropping aria-hidden exposes a contentless canvas to a screen+# reader, and adding tabIndex={-1} makes it focusable for the linter's benefit.+sonar.issue.ignore.multicriteria.canvas1.ruleKey=typescript:S6825+sonar.issue.ignore.multicriteria.canvas1.resourceKey=client/src/pages/login/LoginWorld.tsx