Repository navigation
Releases
v0.4.0
Added
ConsentBanner skipLink: aReactNodeslot rendered before the banner in document
order, so a page's "Skip to content" link stays the first tab stop instead of Accept all
(WCAG 2.4.1). It renders whether or not the banner shows, so it can be the page's one skip
link, and it sits outside the banner's agent fence. Any link works; react-fancy's
SkipLink(6.22.0 and later) is made for it, and this package's react-fancy range is
unchanged because the slot does not import it. Without the prop the banner renders exactly
as before.
Changed
- Releases need a lab-run certificate.
publish.ymlgains a read-only
lab-certificatejob that every publishing job needs: a tag is published only
when the fancy-labs lab has certified that exact version and commit. Consumers
do nothing; this changes how releases are cut, not what the package does.
v0.3.0
Council change CC-fancy-0016, approved by the owner.
Fixed
- The bar banner covered most of a small phone. A consumer measured it at 53% of a
375x667 screen and 67% of a 320x568 one: the body wrapped to 6 or 7 lines and the three
actions stacked full width. Measured again in headless Chromium 151 with the default bar:
375x667: 355px (53%) to 199px (30%); 320x568: 379px (67%) to 197px (35%). From 640px
up nothing changed (215px at 640, 153px at 1280, both before and after).
Changed
- Below
sm(640px) every variant shows a short body, the new message key
fancy-compliance.banner.body-short(English default: "We use necessary cookies, and
others only if you allow them. You can change your mind at any time."). Both texts are
rendered, on the server too, and a media query shows one: no width sniffing, so SSR and
hydration are unchanged. The banner'saria-describedbystill points at
banner-body, and the hidden text isdisplay: none, so it is not read out.
New handles:banner-body-shortandbanner-body-fullinsidebanner-body.
Consumer action: if you translate the banner, addfancy-compliance.banner.body-short
to yourmessages; until you do, a phone shows the English short text. - The preferences dialog now shows the banner's full text above its introduction
(data-fancy-compliance="preferences-summary", styled by the existing
classNames.body), so nothing the short text leaves out is lost. Consumer action:
none. - The bar's three actions sit in one row on a phone. They go three across wherever
their row is at least 17rem (272px) wide, a container query onbanner-layout, so at a
320px viewport each is about 91px wide and 44px tall; they stack only below that. On a
phone all three take tighter side padding (max-sm:px-2), and where the row is under
20rem the md button text size, so "Accept all" stays on one line. All three still share
one set of classes.cardandcornerkeep their action layouts. Consumer action:
none, unless you styledbanner-actionsassuming a stacked phone layout. - Every action carries
break-words, so a long translated label wraps inside its button.
Added
- README: pairing
scroll-padding-bottom: var(--fancy-consent-banner-h, 0px)with the
banner-height variable, so keyboard focus is not scrolled behind the banner, with what
was measured: in Chromium 151, tabbing 24 links on a long page left 11 (375x667) and 16
(320x568) of them behind the banner without it, and 0 with it. Firefox and WebKit were
not measured: the installed Playwright browser builds did not match the available
Playwright, and both failed at page creation.
Unchanged: the data-agent-off-limits="consent" markers, reserveSpace,
--fancy-consent-banner-h / --fancy-consent-banner-top-h, the theme tokens and RTL.
v0.2.1
Fixed
- An agent could use the consent controls. The README promised that an agent may read
consent and never grant, record or withdraw it, but nothing in the markup said so, and
agent-integrations' DOM navigation let an agent click "Accept all", flip a category switch
or save the dialog. ApendingModeconfirm did not fix it: a person approving an agent's
click is still the agent's act. The banner (every variant), the preferences dialog and the
preferences trigger now carrydata-agent-off-limits="consent", which
@particle-academy/agent-integrations0.58.0 refuses on every action path, before
staging, and describes only as "consent region" / "consent dialog". This package still
imports nothing from agent-integrations; the attribute is the contract. Found by PS Mapper.
Thedata-fancy-compliance*handles are unchanged. Consumer action: update both
packages. Hosts that wrote their own guard for these controls can drop it. - The fixed banner covered the page's last content. On a short page the banner sat over
the footer, where this README said to putConsentPreferencesTrigger: a pointer could not
reach it, and with keyboard focus it was hidden behind the banner (WCAG 2.4.11, Focus Not
Obscured). In a full-height app shell it covered the bottom of the shell. While it shows,
the banner now publishes the space it covers (see Added), and the README's placement
advice says to reserve it. Consumer action: addreserveSpace, or use the variable in
your layout. Without either, nothing moves. useConsentControllerthrew when its props were missing. Givenundefinedornull
(thefancyComplianceInertia prop absent, as under Octane with fancy-compliance 0.1.0),
it threw "Cannot read properties of undefined (reading 'routes')" and took the page down.
It now holds a snapshot with no categories andneedsConsent: false, so no banner shows
and nothing optional is allowed, and logs one development-modeconsole.warnnaming the
missing prop and pointing to the README. Its parameter type is now
ConsentSnapshot | null | undefined. Consumer action: none; fix the missing prop if
you see the warning (fancy-compliance 0.1.1 fixes the Octane case).
Added
AGENT_OFF_LIMITS({ "data-agent-off-limits": "consent" }), to spread onto a consent
control you build yourself fromuseConsent()or put in aConsentGatefallback.- The banner publishes the space it covers as CSS custom properties on
<html>:
--fancy-consent-banner-hfor a banner anchored to the bottom, and
--fancy-consent-banner-top-hfor one anchored to the top, in whole pixels, measured
with aResizeObserver(a card's inset included). Removed when the banner hides or
unmounts; read them with a fallback,var(--fancy-consent-banner-h, 0px). Set in effects
only, so server rendering is unchanged. The names are exported as
CONSENT_BANNER_SPACE_VARS. ConsentBannerreserveSpace(defaultfalse): pads<body>by that height while
the banner shows, on top of the body's own padding, and restores it afterwards.
v0.2.0
A styling pass. With no new props, the banner and dialog look the same as 0.1.0 in light
mode and keep their layout in both modes. The markup is not byte-identical: see
Changed for exactly what differs. Nothing was renamed or removed.
Added
-
ConsentBannervariant:"bar"(the default, the 0.1.0 full-width bar),"card"
(a floating react-fancyCard, up to 28rem wide, inset from the edges) and"corner"(a
compactCard, up to 20rem, with the three actions always stacked). On a phone both
floating variants span the width less a 1rem margin, with the actions stacked.
Consumer action: none. Passvariant="card"orvariant="corner"to opt in. -
ConsentBannerposition:"top"/"bottom"for a bar (default"bottom");
"bottom-start"/"bottom-end"/"top-start"/"top-end"for a card or corner
(default"bottom-start", clear of react-fancy's toast stack atbottom-end).startand
endare logical, so they mirror underdir="rtl". The props type is a union, so a bar
position on a card is a type error. Consumer action: none. -
classNameson every styled component, one key per part, merged after the package's
own classes with react-fancy'scn(tailwind-merge), so a conflicting app class replaces
the default instead of fighting it in the cascade:ConsentBanner:surface,layout,content,title,body,actions,action,error.ConsentPreferences:surface,header,title,content,body,categories,
category,categoryLabel,categoryDescription,categoryPurposes,alwaysOn,
switch,actions,action,error.ConsentPreferencesTrigger:trigger.ConsentReloadNotice:surface,body,action.
There is one
actionkey for accept, reject and customise (and reject, accept and save
in the dialog), and no per-button key: a per-button class would let a page make accepting
easier than refusing. A type test fails if one is added. Consumer action: none. -
Handles for the new parts:
data-fancy-compliance-variantand
data-fancy-compliance-positionon the banner;banner-layout,banner-content,
banner-title,banner-body,preferences-header,preferences-title,
preferences-content,preferences-body,preferences-categories,category-label,
category-description,category-purposes,always-onandreload-bodyas values of
data-fancy-compliance. Consumer action: none. -
Exported types:
ConsentBannerVariant,ConsentBannerPosition,ConsentBannerBarPosition,
ConsentBannerFloatingPosition,ConsentBannerClassNames,ConsentPreferencesClassNames,
ConsentPreferencesTriggerClassNames,ConsentReloadNoticeClassNames,
ConsentReloadNoticeProps. Consumer action: none.
Changed
-
Colours come from react-fancy's theme tokens (
--fancy-surface,--fancy-border-strong,
--fancy-border,--fancy-text,--fancy-text-softand their-darktwins), written the
way react-fancy's ownCardandModalwrite them, instead of fixed zinc classes. Set
those variables and the banner and dialog follow the rest of your react-fancy UI.
With none set, the fallbacks are react-fancy's defaults, and the rendered colours are:- Light mode: identical (white surface, zinc-300 border, zinc-900 title, zinc-700 body).
- Dark mode: two text colours move one step, to react-fancy's dark defaults: titles
zinc-50 to zinc-100, body text zinc-200 to zinc-300. Surface (zinc-900), border
(zinc-700) and dividers are unchanged. Measured in Chromium: lowest text contrast 10.08:1
in dark mode, 10.43:1 in light, both above AAA's 7:1.
Consumer action: none. If you want 0.1.0's brighter dark text, set
--fancy-text-dark: var(--color-zinc-50)and--fancy-text-soft-dark: var(--color-zinc-200). -
The markup differs from 0.1.0 in these ways, and only these: the colour classes above;
the newdata-fancy-compliance*attributes listed under Added; class strings are now
produced bycn, so the trailing space 0.1.0 left on the banner and trigger when no
classNamewas passed is gone. Consumer action: only if a snapshot test of yours
stores this markup: update the snapshot. -
classNamenow merges instead of appending, on every component. AclassNamethat
conflicts with a default (sayz-50on the banner, orno-underlineon the trigger) now
replaces it; in 0.1.0 both classes were present and whichever Tailwind emitted later won.
Consumer action: none, unless you relied on a conflicting class losing. -
tscnow typecheckstests/too (exceptpackaging.test.ts, which needs Node types this
repo does not carry), so type-level guards in tests are enforced. Consumer action: none.
v0.1.0
Added
ConsentProvider: controlled consent state (value,onDecide,onWithdraw),
translations by key with English defaults,dir, observableonActivityevents
(alwaysactor: "human"), and an optionally controlled preferences dialog.ConsentBanner: a labelled, non-modal region for the first visit and after a policy
change. Accept all, Reject all and Customise are the same component, size and classes.ConsentPreferences: a modal dialog with a switch per category, its description and
purposes. Nothing optional is pre-ticked; necessary is always on. Switching categories off
after consenting is sent as a withdrawal. It manages its own focus (in, trapped, restored),
because react-fancy 6.9.0'sModaldoes not when opened after mount.ConsentPreferencesTrigger: opens the dialog at any time, for withdrawal.ConsentGate: renders children only while a category is allowed.useConsentScript/ConsentScript: loads a script once allowed; on withdrawal
removes it and runs your cleanup, or reports that a reload is needed.
ConsentReloadNoticeoffers that reload.useConsentController,createConsentClientandreadConsentPropsfor
particle-academy/fancy-compliance's routes, Inertia prop and Blade directive.- Stable
data-fancy-compliance-*handles throughout.
Consumer action: new package. Add both @source lines for Tailwind, and render
ConsentReloadNotice somewhere on the page if you use useConsentScript without cleanups.