diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9155fc4..c3c0113 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -42,6 +42,23 @@ once there are more than 20. - Not built (owner's Q3 answer (a), planned for 2.0): a plugin-wide default for the project's own entities and for Payload's `payload-locked-documents`. +### Changed +- **What an existing site's visitors see: the "cookie settings" button stays in the bottom corner of the window** + ([consent.md → Where the cookie button sits](./consent.md#where-the-cookie-button-sits-1172)). Until now it 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. Now it is in the same corner on every page and at every scroll + position. Only at the very end of the page, where it would keep a footer link or a button covered with no way to + scroll past, it steps up just above it (on the reference site: 71 px on a phone, nothing on desktop). No layout + shift, same look, keyboard and screen-reader access unchanged; the side inset now adds the device's safe-area inset. + **Nothing to do; an existing site gets it by updating.** The placement before: + `` (on `SiteProviders`: `cookieButton={…}`). A site that already passes + `avoid` (a selector, or `false` = never move) or `className` keeps its behaviour. A project e2e test that expects the + button above the footer needs an update. + +### Added +- `CookieButton` prop `clear` (selector of controls freed at the end of the page; `false` = off), `COOKIE_BUTTON_CLEAR`, + `stepAbove` (`/client`). + ## 1.17.1 — security fixes from the IAWL review; the panel's sign-in look; the sending method is chosen > **Read before upgrading.** **MongoDB: no migration. Postgres / SQLite: one migration** — a new column for the diff --git a/docs/agent/AGENT.md b/docs/agent/AGENT.md index 2c425fe..66551c3 100644 --- a/docs/agent/AGENT.md +++ b/docs/agent/AGENT.md @@ -1167,6 +1167,7 @@ project → **plugin gap**, not a copy. |---|---|---| | Banner, settings, cookie button | `}>`, `CookieButton`, `useConsent` | consent.md | | Compliance defaults (1.17.0): Global Privacy Control honoured (no banner, no tracker request, opt-in from the cookie button wins), "Reject" like "Accept all", consent log on, withdrawal tells Meta / TikTok / Clarity and clears listed storage keys | built in; opt-outs: `SiteProviders gpc="ask"` / `gpc={false}`, `CookieBanner equalChoice={false}`, `iapl({ consentLog: false })` / `logEndpoint={false}`, `maxAgeDays` (re-ask, default 180); building blocks `resolveConsent`, `gpcFromHeaders`, `gpcFromNavigator`, `GPC_CATEGORIES`, `GPC_HEADER`, `CONSENT_LOG_PATH`, `gpcWellKnown` (`/.well-known/gpc.json`), `readEffectiveConsent`, `signalVendors`, `clarityConsent` (`/client`). Check: `iapl-consent-check` (5 runs incl. GPC, equal prominence, withdrawal), `iapl-doctor` (`consent-banner`, `consent-log-migration`) | consent.md → "Compliance defaults", consent-behaviour-spec.md | +| Cookie button placement | built in: bottom corner of the window on every page, never in or above the footer; at the page end it steps above a link it would keep covered. `CookieButton side` / `clear` / `avoid` (`avoid={COOKIE_BUTTON_AVOID}` = above the footer, as before 1.17.2; `false` = never move), tokens `--ipal-cookie-button-offset` / `-inset`. Do not render the button inside the footer or write a scroll handler for it | consent.md → "Where the cookie button sits" | | Banner at first paint (not after hydration; LCP) | built in: `CookieBanner firstPaint` (default on), `SiteProviders nonce` under a nonce CSP; off: `firstPaint={false}`; server-exact HTML on a dynamic site: `SiteProviders consentCookie` / `ConsentProvider cookieValue`; your own banner: `consentBannerScript`. Check: `curl -s \| grep -c 'data-ipal="banner-script"'` → 1 and the response still has `s-maxage` | consent.md → "First paint" | | Settings window: in the bar / small / large with cookie details | `` — do not build your own window or cookie list | consent.md → "Large window with details" | | A consent-dependent script | `ConsentScript` | consent.md | diff --git a/docs/agent/skills/iapl-consent-check/SKILL.md b/docs/agent/skills/iapl-consent-check/SKILL.md index ee351d6..b7d462c 100644 --- a/docs/agent/skills/iapl-consent-check/SKILL.md +++ b/docs/agent/skills/iapl-consent-check/SKILL.md @@ -55,6 +55,12 @@ before analytics or marketing consent — check the project's choice in "Project `nonce` to ``. A visitor who decided must never see the banner on reload; one whose decision is from an older Policy version must see it at once. A click on a button before hydration counts (the checks above click as soon as the button is visible). +7. Cookie button (1.17.2, consent.md → "Where the cookie button sits"): after a decision, on a long page, a short + page and a page with a form, desktop and phone width — the button is in the bottom corner of the window at the + top, in the middle and with the footer in view (it must not ride up on the footer); scrolled to the very end it + lies on no link or button (it may step up a little); Tab reaches it and Enter reopens the banner. A footer whose + corner is all links: `side="right"` or a larger `--ipal-cookie-button-offset`. A project scroll handler or a + button rendered inside the footer → remove (AGENT.md §7). The script needs buttons with `data-ipal="accept"` / `"reject"` — the plugin's `CookieBanner` has them in every `settings` mode (`inline`, `modal`, `detailed`). A custom banner in the project violates AGENT.md §7. diff --git a/docs/agent/skills/iapl-reference/resources/api.md b/docs/agent/skills/iapl-reference/resources/api.md index 8748bb4..2463e6e 100644 --- a/docs/agent/skills/iapl-reference/resources/api.md +++ b/docs/agent/skills/iapl-reference/resources/api.md @@ -168,8 +168,9 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant |---|---|---| | `ConsentProvider` | `@intecion/ipal-kit/client` | Consent provider: `{ texts, cookieMap?, logEndpoint?, nonce?, cookieValue?, gpc?, maxAgeDays? }` (`gpc`: Global Privacy Control `'honour'` default / `'ask'` / `false`; `maxAgeDays`: re-ask period, default 180; withdrawal also removes the panel's listed storage keys and tells Meta / TikTok / Clarity) (`nonce`: CSP nonce for the banner's first-paint script; `cookieValue`: optional server-read consent cookie → exact HTML, dynamic pages) — consent state, cookie, Consent Mode, deleting cookies after consent is withdrawn, optional POST of the decision to the log (`'/api/ipal/consent'`). Wrap the layout once; required by the banner, `Analytics`, `ConsentScript`. | | `CookieBanner` | `@intecion/ipal-kit/client` | Consent banner + category settings: `settings: 'inline' \| 'modal' \| 'detailed'`, `controls`, `equalChoice` (recommended `true`), `order`, `settingsActions`, `icon`, `classNames`, `firstPaint` (default `true`: in the server HTML, decided before the first paint by an inline script; pages stay static), `nonce`; colours from `--ipal-*` CSS vars. Do not write your own banner. | -| `CookieButton` | `@intecion/ipal-kit/client` | Floating button that reopens the cookie settings (withdrawing consent); hidden while the banner is visible. Props `className`, `side` (`'left' \| 'right'`), `avoid` (selector it lifts above, default `COOKIE_BUTTON_AVOID` = footer; `false`). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. | -| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Default footer selector; pixels the footer covers at the bottom of the screen (how far the button moves up) | +| `CookieButton` | `@intecion/ipal-kit/client` | Floating button that reopens the cookie settings (withdrawing consent); hidden while the banner is visible. Fixed in the bottom corner of the window on every page (1.17.2: it no longer climbs above the footer); at the very end of the page it steps just above a link or button it would keep covered. Props `className`, `side` (`'left' \| 'right'`), `clear` (selector of controls to free at the page end, default `COOKIE_BUTTON_CLEAR`; `false`), `avoid` (placement before 1.17.2: selector it lifts above — `COOKIE_BUTTON_AVOID` = footer; `false` = never move). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. | +| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Footer selector for the placement before 1.17.2 (``); pixels the footer covers at the bottom of the screen (how far the button moves up then) | +| `COOKIE_BUTTON_CLEAR`, `stepAbove(button, obstacles, max)` | `@intecion/ipal-kit/client` | Default selector of controls the cookie button frees at the end of the page; how far a box must move up to lie on none of the given boxes (0 = stays, also when no free place within `max`) | | `TOTP_TEXTS`, `TOTP_VIEW_TITLE` | `@intecion/ipal-kit` | en/pl texts of the 2FA screens (`totpPlugin:*`, merged by `twoFactor`) and their tab title | | `ConsentScript` | `@intecion/ipal-kit/client` | Loads an external script (`src` or `code`) only after consent for `category` — for vendors without Consent Mode (chat, Plausible etc.). Inside `ConsentProvider`. | | `CookieTable` | `@intecion/ipal-kit/rsc` | Server Component: cookie table for the cookie policy page — `{ rows, labels?, locale?, categories?, caption?, classNames?, storageColumn?, storageTypes? }`; `rows` from `getCookieTable()`; a **Type** column when a row is local / session storage (`storageColumn: 'auto' \| boolean`). | diff --git a/docs/agent/skills/iapl-upgrade/SKILL.md b/docs/agent/skills/iapl-upgrade/SKILL.md index 97a3fd1..81a795b 100644 --- a/docs/agent/skills/iapl-upgrade/SKILL.md +++ b/docs/agent/skills/iapl-upgrade/SKILL.md @@ -34,6 +34,14 @@ the header, 200 with it. (2) A front end that posted to `/api/form-submissions` (3) A site with a visitor login collection: `iapl-doctor --url …` lists `visitor-writes`; give each listed collection and global its own write rule (`adminOrEditor`). (4) If the project has `tests/routes.ts`: `update`, judge, commit. +**→ 1.17.2, cookie button (CHANGELOG 1.17.2; PROGRAMISTA §6, item 83; consent.md "Where the cookie button sits") — nothing is required:** +visitors now see the "cookie settings" button in the bottom corner of the window on every page; it no longer moves up +above the footer. Look at the end of a page on a phone: the button must lie on no link (it steps up by itself; a +footer corner full of links → `side="right"` or a larger `--ipal-cookie-button-offset`). The placement before: +`cookieButton={}` on `SiteProviders`. A project that passes `avoid` (a +selector or `false`) or `className` keeps what it had. A project e2e that expects the button above the footer: +update it. + **→ 1.17.1:** (1) `src/proxy.ts`: replace the matcher literal with `['/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)']` (i18n.md "Next matcher"; `iapl-doctor` rule `proxy-matcher`). The old one skipped every page whose first segment only starts with `api`, `admin` or `_next` (`/administracja`): @@ -261,7 +269,7 @@ and the browser tab shows the same separator. cookie banner only through `--ipal-*-dark`: check the banner in the dark theme. 4. Optional: the block library, block by block (block-library.md); after turning blocks on: `pnpm generate:types`, `pnpm payload generate:importmap`, Postgres/SQLite `migrate:create`. -5. **CookieButton** lifts above the footer — check a site with its own fixed footer bar; `avoid={false}` keeps it fixed. +5. **CookieButton** lifts above the footer — check a site with its own fixed footer bar; `avoid={false}` keeps it fixed. (Since 1.17.2 it stays in the bottom corner by default; the lift is `avoid={COOKIE_BUTTON_AVOID}`.) 6. `pnpm exec iapl-skills` (new **iapl-doctor**; updated iapl-reference, iapl-setup, iapl-site, iapl-audit). 7. Run `pnpm exec iapl-doctor` (and `--url https://`), fix or silence each finding with a reason in `iapl-doctor.json`. `IAPL_DOCTOR_TOKEN` (≥ 32 characters) only if the deep check runs against production. diff --git a/docs/consent.md b/docs/consent.md index 4bfa840..8b13539 100644 --- a/docs/consent.md +++ b/docs/consent.md @@ -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 `` (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 `'), box(750, 790, 20, 140)) + await mount() + expect(lift()).toBe('42') + }) + + test('end of the page, nothing under it (text only): stays in the corner', async () => { + setRect(add('

© Example

'), box(760, 780, 30, 400)) + setRect(add('Terms'), box(760, 780, 900, 960)) + await mount() + await scrollTo(2200) + expect(lift()).toBe('0') + }) + + test('clear={false} and avoid={false}: never moves', async () => { + setRect(add('Instagram'), box(760, 780, 30, 120)) + setRect(add('
company
'), box(500, 1100, 0, 1280)) + await mount({ clear: false }) + await scrollTo(2200) + expect(lift()).toBe('0') + act(() => root.render(h(ConsentProvider, { texts: CONSENT_FALLBACK }, h(CookieButton, { avoid: false })))) + await scrollTo(2200) + expect(lift()).toBe('0') + }) + + test('a selector of your own in clear', async () => { + setRect(add('Instagram'), box(760, 780, 30, 120)) + setRect(add('
chat
'), box(700, 790, 10, 70)) + await mount({ clear: '.chat' }) + await scrollTo(2200) + expect(lift()).toBe(String(784 - 700 + 8)) + }) + + test('className (the project positions it, here not fixed): no step', async () => { + setRect(add('Instagram'), box(760, 780, 30, 120)) + await mount({ className: 'in-the-footer' }) + expect(button().style.position).toBe('') + await scrollTo(2200) + expect(lift()).toBe('0') + }) +})