Cookie button stays in the bottom corner of the window; it no longer climbs above the footer

Owner, 2026-12-01: by default the cookie button should go to the bottom of the page, not to the footer.
Until now the button (fixed, a child of <body>) moved up by the visible part of the footer: on a phone with a tall
footer it ended at the top of the screen over the header, on a short page in the middle of it.

- Default: fixed in the bottom corner on every page and scroll position; safe-area inset also on the side.
- Only at the very end of the page it steps just above a link, button or form field it would keep covered
  (`clear`, COOKIE_BUTTON_CLEAR, stepAbove); a transform, no layout shift.
- The placement before: avoid={COOKIE_BUTTON_AVOID}; avoid={false} still means never move; className as before.

Tests: test/cookieButtonPlacement.test.ts; reference e2e on desktop and phone (corner on long and short pages,
no covered control at the page end, no layout shift, keyboard reopen).
Docs: consent.md "Where the cookie button sits", AGENT.md, skills, PROGRAMISTA item 83, changelog draft 1.17.2.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 10:49:23 +01:00
co-authored by Claude Fable 5.2
parent fc70a34f3e
commit 1025446a28
15 changed files with 426 additions and 28 deletions
+28 -6
View File
@@ -113,12 +113,34 @@ takes `locale` and optional `labels`; defaults: `COOKIE_TABLE_LABELS` (`@intecio
| `controls` | `'checkbox'` | `'checkbox' \| 'switch'` |
| `settingsActions` | `['back', 'save']` | buttons under the categories (`'accept' \| 'back' \| 'reject' \| 'save'`) |
`CookieButton` props: `className` (replaces the default classes; position is then yours too),
`side` (`'left'` default or `'right'`), `avoid` (CSS selector, default `COOKIE_BUTTON_AVOID` =
`'footer, [role="contentinfo"]'`; `false` = never move). While the footer is on screen the button
moves up by its visible part (`bottomOverlap`), so it never covers footer links. Position tokens:
`--ipal-cookie-button-offset` (from the bottom, default `1rem`), `--ipal-cookie-button-inset` (from the
side, default `1rem`); z-index `--ipal-z-header`. Type `CookieButtonProps`.
### Where the cookie button sits (1.17.2)
`CookieButton` is fixed in the **bottom corner of the window** — on every page, long or short, at every scroll
position, on desktop and phone. It is a child of `<body>` (never inside the footer) and it no longer climbs above
the footer when the footer scrolls into view (1.12.x–1.17.1 did that: on a phone with a tall footer the button ended
at the top of the screen, on a short page in the middle of it).
One exception keeps every control reachable: **at the very end of the page**, where a visitor cannot scroll a
covered link out from under a fixed button, the button steps up just far enough to lie on no link, button or form
field (`stepAbove`; 8 px gap; never more than half the window, otherwise it stays in the corner). It then usually
rests on plain text of the footer (the copyright line). Anywhere above the end of the page it stays in the corner: a
covered control is one scroll away. The step is a `transform` — no layout shift.
| Prop | Default | What it does |
|---|---|---|
| `side` | `'left'` | corner: `'left'` or `'right'` |
| `clear` | `COOKIE_BUTTON_CLEAR` (links, buttons, form fields) | CSS selector of controls the button frees at the end of the page; `false` = stay in the corner whatever is under it |
| `avoid` | — | placement before 1.17.2: a CSS selector the button lifts above while it is on screen — `avoid={COOKIE_BUTTON_AVOID}` (`'footer, [role="contentinfo"]'`) is exactly the old default (`bottomOverlap`). `false` = never move at all (also turns `clear` off) |
| `className` | — | replaces the default classes; position is then yours too (the `clear` step applies only while your classes keep it `position: fixed`) |
Position tokens: `--ipal-cookie-button-offset` (from the bottom, default `1rem`), `--ipal-cookie-button-inset`
(from the side, default `1rem`); the device's safe-area insets (bottom and the chosen side) are added. z-index
`--ipal-z-header` (default 40): above the page, below the banner, the settings window and the lightbox (50).
Hidden while the banner is showing. Keyboard: a `<button>` in the tab order with an `aria-label` from the panel.
Type `CookieButtonProps`.
A footer that is full of links in that corner: choose `side="right"`, raise `--ipal-cookie-button-offset`, or give
the footer's last row some bottom padding — the button then rests there.
## Compliance defaults (1.17.0)