Add comment to 2.4.3 Release Notes on backward incompatibility of cookie status banner change #9095
Description
Upon upgrade to 2.4.3 any store with a pre-existing custom theme will display the "The store will not work correctly in the case when cookies are disabled." banner of every store page, when in fact cookies are enabled. This is caused by a backward incompatible change in M2.4.3 and how it handles the cookie status message. This issue seems so common that it deserves a comment in the 2.4.3 release notes regarding backward compatibility with pre-existing themes.
https://github.com/magento/magento2/search?q=41474&type=commits
Starting with M2.4.0, but prior to M2.4.3 the cookie status message was hidden by default using a bit of inline js that was injected in the theme by /view/frontend/templates/js/cookie_status.phtml
<script type="text/javascript">document.querySelector("#cookie-status").style.display="none";</script>
However, if the "Move JS code to the bottom of the page" setting (Store > Configurations > Advance > Developer > JavaScript Settings) was enabled, a delay of the script injection caused a brief flash of the banner that may have resulted in layout shift. Starting with 2.4.3 the banner is now hidden using a css class that was added to the M2.4.3 blank and luma themes by /web/css/source/_module.less (although perhaps the better implementation would have been to put it in the core rather than the theme.)
.cookie-status-message {
display: none;
}
The change in default behavior for M2.4.3 affects pre-existing custom themes that provide their own version of _module.less because they will not contain the additional css class needed to hide the cookie status message. The solution is to add the cookie-status-message class to _module.less of custom themes.
An alternative solution if unable or unwilling to edit the theme css is to remove the cookie status banner from the head by adding the following code to app/code//Theme/layout/default_head_blocks.xml However, removing the cookie status banner entirely would disable the warning message if the case is the browser actually HAS disabled cookies.
<body>
<referenceContainer name="after.body.start">
<referenceBlock name="cookie-status-check" remove="true"/>
</referenceContainer>
</body>