Skip to content

Commit

Permalink
fix: used collapseOpen variable to change aria-label message
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrina-bongiovanni committed Mar 18, 2024
1 parent 85a60ba commit 9a0d9a1
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,18 @@ const Navigation = ({ pathname }) => {
document.body.removeEventListener('click', blocksClickListener);
}, []);

console.log(collapseOpen);

return (
<Header theme="" type="navbar">
{menu?.length > 0 ? (
<HeaderContent expand="lg" megamenu id="navigation">
<HeaderToggler
aria-controls="it-navigation-collapse"
aria-expanded={collapseOpen}
aria-label={intl.formatMessage(messages.ToggleMenu)}
aria-label={intl.formatMessage(messages.ToggleMenu, {
action: collapseOpen ? 'Chiudi' : 'Apri',
})}
onClick={() => {
setCollapseOpen(!collapseOpen);
setFocusTrapActive(!focusTrapActive);
Expand Down Expand Up @@ -177,7 +181,7 @@ const messages = defineMessages({
},
ToggleMenu: {
id: 'toggle-menu',
defaultMessage: 'Apri o chiudi il menu',
defaultMessage: '{action} il menu',
},
});

Expand Down

0 comments on commit 9a0d9a1

Please sign in to comment.