Skip to content

Commit

Permalink
fix: close Megamenu on mobile when click on subsite link (#635)
Browse files Browse the repository at this point in the history
* fix: closeMenu working when subsiteMenu diff from main

* docs: rlease
  • Loading branch information
Wagner3UB authored Apr 8, 2024
1 parent 7d74181 commit 60c9eb9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
- Sistemato layout del menu laterale sinistro nella vista del Bando
- Sistemato il flag Mostra tipologia bandi nel blocco elenco con variazione Bandi in Evidenza
- Tradotto il messaggio per Screen Reader del bottone per aprire e chiudere il menu in mobile.
- Menu dropdown si chiude correttamente quando il percorso è un sottosito con un menu diverso rispetto al sito principale

## Versione 7.25.3 (07/03/2024)

Expand Down
7 changes: 5 additions & 2 deletions src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const isChildActive = (itemUrl, pathname) => {
return pathname.indexOf(itemUrl) > -1;
};

const MegaMenu = ({ item, pathname }) => {
const MegaMenu = ({ item, pathname, closeMenu }) => {
const intl = useIntl();
const blocksFieldname = getBlocksFieldname(item);
const blocksLayoutFieldname = getBlocksLayoutFieldname(item);
Expand Down Expand Up @@ -317,7 +317,10 @@ const MegaMenu = ({ item, pathname }) => {
title={child.title}
condition={!!child['@id']}
key={child['@id']}
onClick={() => setMenuStatus(false)}
onClick={() => {
setMenuStatus(false);
closeMenu();
}}
className={cx('list-item', {
active: isChildActive(
flattenToAppURL(child['@id']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ const Navigation = ({ pathname }) => {
item={item}
pathname={pathname}
key={index + 'mm'}
closeMenu={() => {
setCollapseOpen(false);
}}
/>
))}
</Nav>
Expand Down

0 comments on commit 60c9eb9

Please sign in to comment.