diff --git a/RELEASE.md b/RELEASE.md index fc40c1164..c1378f4e3 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -41,17 +41,14 @@ - ... --> -## Versione X.X.X (dd/mm/yyyy) +## Versione x.x.x (dd/mm/yyyy) ### Fix - Diminuita la larghezza del testo nelle card che indicano i luoghi. +- Risolto un problema nel blocco Video Gallery, per cui alcuni video di youtube non erano riproducibili. -### Migliorie - -- Migliorata l'accessibilità nella pagina di Ricerca. - -## Versione 11.1.4 (dd/mm/yyyy) +## Versione 11.1.4 (05/01/2024) ### Fix diff --git a/package.json b/package.json index 90db87504..40da639b4 100644 --- a/package.json +++ b/package.json @@ -131,6 +131,7 @@ "htmldiff-js": "1.0.5", "marked": "9.0.0", "react-dropzone": "11.0.1", + "react-focus-lock": "2.9.4", "react-google-recaptcha-v3": "1.7.0", "react-select": "^4.3.1", "react-slick": "^0.29.0", diff --git a/src/components/Collapse.jsx b/src/components/Collapse.jsx index 86f21de0d..26a1d1446 100644 --- a/src/components/Collapse.jsx +++ b/src/components/Collapse.jsx @@ -39,10 +39,10 @@ const Collapse = ({ children, isOpen, onOverlayClick, + showCloseButton = true, // deprecato da v12.0.0 ...attributes }) => { const intl = useIntl(); - if (navbar && header) { const classes = classNames(className, 'navbar-collapse', { expanded: isOpen, @@ -60,16 +60,21 @@ const Collapse = ({ style={{ display: isOpen ? 'block' : 'none' }} onClick={onOverlayClick} > -
- -
+ {/* Deprecato - non viene più utilizzato da v12.0.0 per ragioni di accessibilità + Close button ora presente in Navigation.jsx + */} + {showCloseButton && ( +
+ +
+ )} {children} ); diff --git a/src/components/ItaliaTheme/Blocks/VideoGallery/Block/ViewBlock.jsx b/src/components/ItaliaTheme/Blocks/VideoGallery/Block/ViewBlock.jsx index 19eeafa25..f28b3448c 100644 --- a/src/components/ItaliaTheme/Blocks/VideoGallery/Block/ViewBlock.jsx +++ b/src/components/ItaliaTheme/Blocks/VideoGallery/Block/ViewBlock.jsx @@ -6,13 +6,10 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Embed } from 'semantic-ui-react'; -import { - isInternalURL, - getParentUrl, - flattenToAppURL, -} from '@plone/volto/helpers'; +import { isInternalURL, getParentUrl } from '@plone/volto/helpers'; import { ConditionalEmbed } from 'volto-gdpr-privacy'; import { FontAwesomeIcon } from 'design-comuni-plone-theme/components/ItaliaTheme'; +import { videoUrlHelper } from 'design-comuni-plone-theme/helpers'; import { useIntl, defineMessages } from 'react-intl'; import config from '@plone/volto/registry'; @@ -34,23 +31,36 @@ const messages = defineMessages({ */ const ViewBlock = ({ data, index, isEditMode = false }) => { const intl = useIntl(); - let placeholder = data.preview_image - ? isInternalURL(data.preview_image) - ? `${flattenToAppURL(data.preview_image)}/@@images/image` - : data.preview_image - : null; - if (!placeholder && data.url) { - if (data.url.match('youtu')) { - //load video preview image from youtube + let placeholder = null; + let videoID = null; + let listID = null; - const videoID = data.url.match(/.be\//) - ? data.url.match(/^.*\.be\/(.*)/)?.[1] - : data.url.match(/^.*\?v=(.*)$/)?.[1]; - placeholder = 'https://img.youtube.com/vi/' + videoID + '/hqdefault.jpg'; - } else if (data.url.match('vimeo')) { - const videoID = data.url.match(/^.*\.com\/(.*)/)[1]; - placeholder = 'https://vumbnail.com/' + videoID + '.jpg'; + if (data.url) { + const [computedID, computedPlaceholder] = videoUrlHelper( + data.url, + data?.preview_image, + ); + if (computedID) { + videoID = computedID; + } + if (computedPlaceholder) { + placeholder = computedPlaceholder; + } + + if (data.url.match('list')) { + const matches = data.url.match(/^.*\?list=(.*)|^.*&list=(.*)$/); + listID = matches[1] || matches[2]; + + let thumbnailID = null; + if (data.url.match(/\?v=(.*)&list/)) { + thumbnailID = data.url.match(/^.*\?v=(.*)&list(.*)/)[1]; + } + if (data.url.match(/\?v=(.*)\?list/)) { + thumbnailID = data.url.match(/^.*\?v=(.*)\?list(.*)/)[1]; + } + placeholder = + 'https://img.youtube.com/vi/' + thumbnailID + '/hqdefault.jpg'; } } @@ -90,31 +100,17 @@ const ViewBlock = ({ data, index, isEditMode = false }) => { <> {data.url.match('list') ? ( ) : ( - + )} ) : ( <> {data.url.match('vimeo') ? ( - + ) : ( <> {data.url.match('.mp4') ? ( diff --git a/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx b/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx index 7a17726ac..e55aede9d 100644 --- a/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx +++ b/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx @@ -112,13 +112,14 @@ const MegaMenu = ({ item, pathname }) => { if (item.mode === 'simpleLink') { return item.linkUrl?.length > 0 ? ( - + {isItemActive && ( @@ -238,7 +239,7 @@ const MegaMenu = ({ item, pathname }) => { } return ( - + { } }} title={intl.formatMessage(messages.closeMenu)} + // APG spec: on Tab menu closes, so remove it from focusable elements + // https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation/ + tabIndex="-1" > @@ -278,10 +282,14 @@ const MegaMenu = ({ item, pathname }) => { {childrenGroups.map((group, index) => ( - + {group.map((child, idx) => { return ( -
  • +
  • {child.showAsHeader ? (

    { key={child['@id']} onClick={() => setMenuStatus(false)} role="menuitem" + aria-current="page" > {child.title} @@ -362,12 +371,13 @@ const MegaMenu = ({ item, pathname }) => { - -
  • + +
  • setMenuStatus(false)} + role="menuitem" > {item.showMoreText?.length > 0 diff --git a/src/components/ItaliaTheme/MenuSecondary/MenuSecondary.jsx b/src/components/ItaliaTheme/MenuSecondary/MenuSecondary.jsx index 4dfd91056..c596d944d 100644 --- a/src/components/ItaliaTheme/MenuSecondary/MenuSecondary.jsx +++ b/src/components/ItaliaTheme/MenuSecondary/MenuSecondary.jsx @@ -44,17 +44,18 @@ const MenuSecondary = ({ pathname }) => { return ( items?.length > 0 && ( -