Skip to content

PLANET-7978: Make cookie notice properly focusable#2906

Open
GP-Dan-Tovbein wants to merge 1 commit intomainfrom
PLANET-7978_make-cookie-notice-focusable
Open

PLANET-7978: Make cookie notice properly focusable#2906
GP-Dan-Tovbein wants to merge 1 commit intomainfrom
PLANET-7978_make-cookie-notice-focusable

Conversation

@GP-Dan-Tovbein
Copy link
Contributor

Summary

Make the cookie notice block more accesible by screen readers:

  • Reorder elements
  • Modify styles
  • Improve react hooks

Ref: https://greenpeace-planet4.atlassian.net/browse/PLANET-7978

Testing

screenshot.mov

@GP-Dan-Tovbein GP-Dan-Tovbein self-assigned this Feb 27, 2026
@GP-Dan-Tovbein GP-Dan-Tovbein added Review UAT Needed This PR requires User Acceptance Tests before merge labels Feb 27, 2026
@GP-Dan-Tovbein GP-Dan-Tovbein marked this pull request as ready for review February 27, 2026 19:50
const marketingCookiesChecked = [NECESSARY_MARKETING, NECESSARY_ANALYTICAL_MARKETING].includes(consentCookie);
const hasConsent = marketingCookiesChecked || analyticalCookiesChecked;

const updateNoTrackCookie = () => {
Copy link
Contributor Author

@GP-Dan-Tovbein GP-Dan-Tovbein Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to an anonymous function inside a useEffect hook.

There is no sense to define a function outside the hook if that function it's not exported or used by only once.

gtag('set', 'ads_data_redaction', ad_storage);
};

const toggleHubSpotConsent = () => {
Copy link
Contributor Author

@GP-Dan-Tovbein GP-Dan-Tovbein Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to an anonymous function inside a useEffect hook.

There is no sense to define a function outside the hook if that function it's not exported or used by only once.

useEffect(toggleHubSpotConsent, [marketingCookiesChecked, userRevokedMarketingCookies]);
}, [marketingCookiesChecked, userRevokedMarketingCookies]);

const updateActiveConsentChoice = () => {
Copy link
Contributor Author

@GP-Dan-Tovbein GP-Dan-Tovbein Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to an anonymous function inside a useEffect hook.

There is no sense to define a function outside the hook if that function it's not exported or used by only once.

planet-4 added a commit to greenpeace/planet4-test-oberon that referenced this pull request Feb 27, 2026
/unhold 4de17b33-21f9-41c7-a344-ee0afa366c9a
@planet-4
Copy link
Contributor

planet-4 commented Feb 27, 2026

Test instance is ready 🚀

🌑 oberon | admin | blocks report | CircleCI | composer-local.json

⌚ 2026.02.27 20:09:32

Ref: https://greenpeace-planet4.atlassian.net/browse/PLANET-7978

- Reorder elements
- Modify styles
- Improve react hooks
- Hooks always on top
@GP-Dan-Tovbein GP-Dan-Tovbein force-pushed the PLANET-7978_make-cookie-notice-focusable branch from cc43f62 to 31d120a Compare February 27, 2026 20:00
const hasConsent = marketingCookiesChecked || analyticalCookiesChecked;

const updateNoTrackCookie = () => {
useEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

</button>
</div>
<button tabindex="0" class="close-cookies-settings" aria-label="{{__('Close cookies settings', 'planet4-master-theme')}}">
<div class="close-icon"></div>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to create this workaround since mask and focus are not fully compatible with all browsers

<li><a href="#footer">{{ __( 'Skip to Footer', 'planet4-master-theme' ) }}</a></li>
</ul>

{% block cookies %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to top

planet-4 added a commit to greenpeace/planet4-test-oberon that referenced this pull request Feb 27, 2026
/unhold 11e9db94-c7aa-41f2-a22b-3abb7b9aeaeb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review [Test Env] oberon UAT Needed This PR requires User Acceptance Tests before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants