diff --git a/CHANGELOG.md b/CHANGELOG.md index 8679eb4c..b51f6613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -### [3.1.0](https://github.com/eea/volto-eea-website-theme/compare/3.0.0...3.1.0) - 5 November 2024 +### [3.2.0](https://github.com/eea/volto-eea-website-theme/compare/3.1.0...3.2.0) - 11 November 2024 + +#### :hammer_and_wrench: Others + +- Update package.json [Ichim David - [`4b5073b`](https://github.com/eea/volto-eea-website-theme/commit/4b5073b60a7d144597363f89d5cba6357baa9e19)] +### [3.1.0](https://github.com/eea/volto-eea-website-theme/compare/3.0.0...3.1.0) - 6 November 2024 #### :hammer_and_wrench: Others -- fix Grid conversion, ref #278618 [Miu Razvan - [`f80b786`](https://github.com/eea/volto-eea-website-theme/commit/f80b7869b4ac060bf35250cf5045ab930a0003de)] ## [3.0.0](https://github.com/eea/volto-eea-website-theme/compare/2.4.0...3.0.0) - 21 October 2024 #### :nail_care: Enhancements @@ -115,7 +119,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). #### :hammer_and_wrench: Others - modified param of dateIsInFuture to signal it's a string and not a date [David Ichim - [`e3243a0`](https://github.com/eea/volto-eea-website-theme/commit/e3243a075969a379462ba0b7889fe0d8b52af62a)] -## [2.0.0](https://github.com/eea/volto-eea-website-theme/compare/1.34.0...2.0.0) - 13 May 2024 +## [2.0.0](https://github.com/eea/volto-eea-website-theme/compare/1.35.0...2.0.0) - 13 May 2024 #### :rocket: New Features @@ -140,6 +144,18 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). #### :hammer_and_wrench: Others - Bump package version to 2.0.0 to signal major release due to Volto 17 jump [David Ichim - [`ffe3049`](https://github.com/eea/volto-eea-website-theme/commit/ffe3049b3b656093a44f05044dbe7cd63bac495f)] +### [1.35.0](https://github.com/eea/volto-eea-website-theme/compare/1.34.0...1.35.0) - 6 November 2024 + +#### :bug: Bug Fixes + +- fix(slate) - fix console error on list element - ref #278427 [kreafox - [`2ea7dd1`](https://github.com/eea/volto-eea-website-theme/commit/2ea7dd1488782db09ca3b8636a932930326f1175)] +- fix: cypress 13.1.0 [kreafox - [`0636604`](https://github.com/eea/volto-eea-website-theme/commit/0636604cf023730927c0006dcb146d5f9e086f1c)] + +#### :hammer_and_wrench: Others + +- Revert "Release 1.35.0" [alin - [`dcc318a`](https://github.com/eea/volto-eea-website-theme/commit/dcc318a5082e3c7fff44d00bfd9bb140c4efc21a)] +- Revert "1.35.1" [alin - [`6012bc6`](https://github.com/eea/volto-eea-website-theme/commit/6012bc68cf7a692fc964610a6071c82d4211fb2e)] +- Release 1.35.0 [kreafox - [`e21bee6`](https://github.com/eea/volto-eea-website-theme/commit/e21bee61e55e6c6b46d0119059f7a6063b0edad8)] ### [1.34.0](https://github.com/eea/volto-eea-website-theme/compare/1.33.2...1.34.0) - 9 May 2024 #### :bug: Bug Fixes diff --git a/cypress/e2e/01-block-basics.cy.js b/cypress/e2e/01-block-basics.cy.js index 4a9ce0a7..a7989ea9 100644 --- a/cypress/e2e/01-block-basics.cy.js +++ b/cypress/e2e/01-block-basics.cy.js @@ -105,6 +105,16 @@ describe('Blocks Tests', () => { // then the page view should contain our changes cy.get('.accordion-header').contains('Nav title'); + + // resize window to make tablet or mobile condition work + cy.viewport(375, 667); cy.get('.accordion-header').click(); + + // trigger outside click + cy.get('body').click(); + + // use enter to open accordion + cy.get('.accordion-header').trigger('keydown', { keyCode: 13, which: 13 }); + cy.get('.accordion-header').contains('Nav title'); }); }); diff --git a/package.json b/package.json index ab583afe..1d332f9e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eeacms/volto-eea-website-theme", - "version": "3.1.0", + "version": "3.2.0", "description": "@eeacms/volto-eea-website-theme: Volto add-on", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", @@ -24,8 +24,8 @@ "url": "git@github.com:eea/volto-eea-website-theme.git" }, "dependencies": { - "@eeacms/volto-block-style": "*", "@eeacms/volto-block-toc": "*", + "@eeacms/volto-block-style": "*", "@eeacms/volto-eea-design-system": "*", "@eeacms/volto-group-block": "*", "volto-subsites": "*" diff --git a/src/components/manage/Blocks/ContextNavigation/variations/Accordion.jsx b/src/components/manage/Blocks/ContextNavigation/variations/Accordion.jsx index 82eaeac0..8496d8c1 100644 --- a/src/components/manage/Blocks/ContextNavigation/variations/Accordion.jsx +++ b/src/components/manage/Blocks/ContextNavigation/variations/Accordion.jsx @@ -4,18 +4,15 @@ import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { withRouter } from 'react-router'; import { compose } from 'redux'; -import { Accordion } from 'semantic-ui-react'; +import { Accordion, Icon } from 'semantic-ui-react'; import Slugger from 'github-slugger'; -import { Icon, UniversalLink } from '@plone/volto/components'; +import { UniversalLink, MaybeWrap } from '@plone/volto/components'; import { withContentNavigation } from '@plone/volto/components/theme/Navigation/withContentNavigation'; import withEEASideMenu from '@eeacms/volto-block-toc/hocs/withEEASideMenu'; import { flattenToAppURL } from '@plone/volto/helpers'; -import downIcon from '@plone/volto/icons/down-key.svg'; -import upIcon from '@plone/volto/icons/up-key.svg'; - const messages = defineMessages({ navigation: { id: 'Navigation', @@ -33,6 +30,8 @@ const AccordionNavigation = ({ const navOpen = ['mobile', 'tablet'].includes(device) ? false : true; const [isNavOpen, setIsNavOpen] = React.useState(navOpen); const [activeItems, setActiveItems] = React.useState({}); + const contextNavigationListRef = React.useRef(null); + const summaryRef = React.useRef(null); const onClickSummary = React.useCallback((e) => { e.preventDefault(); @@ -43,6 +42,26 @@ const AccordionNavigation = ({ if (isMenuOpenOnOutsideClick === false) setIsNavOpen(false); }, [isMenuOpenOnOutsideClick]); + React.useEffect(() => { + if (!navOpen) { + const handleOutsideClick = (event) => { + if ( + summaryRef.current && + contextNavigationListRef.current && + !summaryRef.current.contains(event.target) && + !contextNavigationListRef.current.contains(event.target) + ) { + setIsNavOpen(false); + } + }; + + document.addEventListener('click', handleOutsideClick); + return () => { + document.removeEventListener('click', handleOutsideClick); + }; + } + }, [summaryRef, navOpen]); + const onKeyDownSummary = React.useCallback( (e) => { if (e.keyCode === 13 || e.keyCode === 32) { @@ -95,7 +114,11 @@ const AccordionNavigation = ({ id={`accordion-title-${normalizedTitle}`} > {title} - + -