Closed rcantin-w closed 1 month ago
Size Change: +912 B (+0.09%)
Total Size: 968 kB
Filename | Size | Change | |
---|---|---|---|
content/webapp/.next/static/chunks/1002-f6d5c85e15352818.js |
0 B | -4.22 kB (removed) | π |
content/webapp/.next/static/chunks/8651-cd800b1313c083e8.js |
0 B | -3.12 kB (removed) | π |
content/webapp/.next/static/chunks/pages/_app-846deaf8fa6211e1.js |
0 B | -107 kB (removed) | π |
identity/webapp/.next/static/chunks/pages/_app-c1b27092dfd123f5.js |
0 B | -99.3 kB (removed) | π |
identity/webapp/.next/static/chunks/pages/index-1eae79998a41a8aa.js |
0 B | -11.9 kB (removed) | π |
content/webapp/.next/static/chunks/1002-c9f63056c57ba987.js |
4.28 kB | +4.28 kB (new file) | π |
content/webapp/.next/static/chunks/8651-406a4d8be8263f2e.js |
3.17 kB | +3.17 kB (new file) | π |
content/webapp/.next/static/chunks/pages/_app-218f91b12f017c7a.js |
107 kB | +107 kB (new file) | π |
identity/webapp/.next/static/chunks/pages/_app-0101be56ac57db6d.js |
99.8 kB | +99.8 kB (new file) | π |
identity/webapp/.next/static/chunks/pages/index-5c1854081d923910.js |
12 kB | +12 kB (new file) | π |
We also can't use CivicUK's callbacks to re-activate FocusTrap as it offers one for onAccept and onRevoke, but not for when a user dismisses the cookie preferences by clicking "Manage cookies" and then simply "Save and close".
It is quite disappointing that this is the case, I would have expected there to be some kind of signal for any choice even dismissal.
It is quite disappointing that this is the case, I would have expected there to be some kind of signal for any choice even dismissal.
Agreed and I'm hoping this isn't just me having missed something..!
Who is this for?
10915
What is it doing for them?
This PR adds a value in the context that checks if the cookie banner has been acknowledged. I put it at that level as I thought it could be useful elsewhere, but if we think it's overkill I can move it.
In that regard, I've added the context to Storybook and to the concerned tests.
What's going on?
The banner can be considered acknowledged in three different ways:
CookieControl
cookie is set, and the banner is removed from the DOM.CookieControl
cookie is set, and the banner is removed from the DOM.Because the cookie is not automatically set at the same time as everything is removed from the DOM, we can't count on detecting the cookie to re-activate the
FocusTrap
. We also can't use CivicUK's callbacks to re-activateFocusTrap
as it offers one foronAccept
andonRevoke
, but not for when a user dismisses the cookie preferences by clicking "Manage cookies" and then simply "Save and close".So we have to find out when the banner and popup are fully removed from the DOM, and we can do that by detecting when the
#ccc
Element (ccc
being the ID of the parent container) has zero children left - because yes, the parent stays in the DOM, but is an empty div. I'm thinking it's so the Preference centre popup knows where to inject itself should it be called up again. Only then can we then activate theFocusTrap
. We useccc-overlay
to check if the banner is up as it is a sibling of both the popup and the banner should one of them be active.This was a bit of a maze so happy to jump on a call to run through it.