fix(ui): end an anchored dialog above the tablet keyboard

Final review M-2: maxHeight runs to the visual viewport's bottom, not
the layout viewport's, so « Enregistrer » stays reachable while a
keyboard leaves 320 px or more. New unit case beside the keyboard one.
This commit is contained in:
bchanot committed 2026-11-18 13:00:11 +01:00
1 parent 9e1ec4479d
commit 323a342586
2 files changed
+20 -1

No files matched your search

+19
View File
@@ -306,6 +306,25 @@ describe('Dialog anchored over a column', () => {
expect(panel().style.left).toBe('900px')
})
it('a tablet keyboard leaving 320 px or more: the panel ends 12 px above it (M-2)', () => {
window.innerHeight = 800
withViewport({
height: 500,
offsetTop: 0,
addEventListener: () => undefined,
removeEventListener: () => undefined,
})
const anchor = anchorAt({ left: 900, top: 140, width: 352 })
render(
<Dialog open anchor={anchor} onClose={() => {}} title="X">
body
</Dialog>,
)
expect(panel().style.top).toBe('140px')
// 500 - 140 - 12: « Enregistrer » stays above the keyboard.
expect(panel().style.maxHeight).toBe('348px')
})
it('without an anchor box the panel is centred, as before', () => {
render(
<Dialog open anchor={{ current: null }} onClose={() => {}} title="X">