fix(tours): the checklist keeps to its tour, its state and its focus

A decision answered after another tour was opened no longer replaces that
tour's checklist. A decision made offline on a checklist already older than
the route stays marked as such, and once online a bench from a write made
offline waits for the queue to replay, then takes in the server's. While
the checklist reads again it stays in view, locked, so a panel open on the
map keeps its note. A saved tour turned into a paddle tour asks to be saved
first, a vanished obstacle stays among the rows, Next follows the list
order and keeps the focus in the panel, a note closes only once saved, the
earlier choice in review is named for screen readers too, planning a
portage is offered to editors only, and the map card scrolls within the
screen. A tooltip of several lines breaks at them. A page test waits for
the tours row instead of reading it at once.
This commit is contained in:
Maurice
2026-10-17 02:07:22 +00:00
parent 2a4b71b3d9
commit a7f5a114e6
15 changed files with 404 additions and 89 deletions
+13 -1
View File
@@ -1,4 +1,4 @@
// FE-W4TIP-001 to FE-W4TIP-014
// FE-W4TIP-001 to FE-W4TIP-015
import { createRef, useRef } from 'react'
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import { render, screen, fireEvent, act } from '../../../tests/helpers/render'
@@ -181,4 +181,16 @@ describe('Tooltip — inside a component that owns the ref', () => {
expect(screen.getByRole('button')).toHaveAttribute('data-clicked', '1')
})
it('FE-W4TIP-015: a label of several lines breaks at them and stays within the window, a single line does not wrap', () => {
const { unmount } = render(<Tooltip label={'3 open\nNo safety or legal clearance.'}><button>x</button></Tooltip>)
hover(screen.getByRole('button'))
expect(screen.getByRole('tooltip')).toHaveStyle({ whiteSpace: 'pre-line' })
expect(screen.getByRole('tooltip').style.maxWidth).toContain('100vw')
unmount()
render(<Tooltip label="Delete"><button>y</button></Tooltip>)
hover(screen.getByRole('button'))
expect(screen.getByRole('tooltip')).toHaveStyle({ whiteSpace: 'nowrap' })
})
})
+3 -1
View File
@@ -92,7 +92,9 @@ export function Tooltip({ label, placement = 'bottom', delay = 250, disabled, ch
fontWeight: 500,
padding: '5px 10px',
borderRadius: 8,
whiteSpace: 'nowrap',
// A label of several lines (the paddle check bench) breaks at its lines and wraps within the window.
whiteSpace: label.includes('\n') ? 'pre-line' : 'nowrap',
maxWidth: label.includes('\n') ? 'min(22rem, calc(100vw - 12px))' : undefined,
boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
fontFamily: "var(--font-system)",
transformOrigin: placement === 'top' ? 'bottom center' : placement === 'bottom' ? 'top center' : placement === 'left' ? 'center right' : 'center left',