Merge claude/cookie-button-bottom: the cookie button stays in the bottom corner of the window
Conflicts in the 1.17.2 changelog draft and the upgrade skill: both sides kept (rewritten into one entry at release). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+28
-6
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user