diff --git a/docs/source/upgrade-guide/index.md b/docs/source/upgrade-guide/index.md index 39e374ea36..9002e73689 100644 --- a/docs/source/upgrade-guide/index.md +++ b/docs/source/upgrade-guide/index.md @@ -474,6 +474,11 @@ The recommended way of generating a project boilerplate is [Cookieplone](https:/ Please update your code to use the `pnpm` based setup. ``` +### Table of Contents block markup change + +The `View` component for the Table of Contents block was updated to use a `nav` element instead of a `div`. +If you've applied custom styles or shadowed this component, you might need to make adjustments. + ### Update needed to project boilerplate generated with `@plone/generator-volto` ```{versionadded} Volto 18.0.0-alpha.42 diff --git a/packages/volto/locales/ca/LC_MESSAGES/volto.po b/packages/volto/locales/ca/LC_MESSAGES/volto.po index b17def638e..2a0df0c74c 100644 --- a/packages/volto/locales/ca/LC_MESSAGES/volto.po +++ b/packages/volto/locales/ca/LC_MESSAGES/volto.po @@ -3563,8 +3563,7 @@ msgid "Table" msgstr "Taula" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "Taula de continguts" diff --git a/packages/volto/locales/de/LC_MESSAGES/volto.po b/packages/volto/locales/de/LC_MESSAGES/volto.po index bd271eca1a..ce33292e57 100644 --- a/packages/volto/locales/de/LC_MESSAGES/volto.po +++ b/packages/volto/locales/de/LC_MESSAGES/volto.po @@ -3562,8 +3562,7 @@ msgid "Table" msgstr "Tabelle" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "Inhaltsverzeichnis" diff --git a/packages/volto/locales/en/LC_MESSAGES/volto.po b/packages/volto/locales/en/LC_MESSAGES/volto.po index 419d5717b1..c409547b21 100644 --- a/packages/volto/locales/en/LC_MESSAGES/volto.po +++ b/packages/volto/locales/en/LC_MESSAGES/volto.po @@ -3557,8 +3557,7 @@ msgid "Table" msgstr "" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "" diff --git a/packages/volto/locales/es/LC_MESSAGES/volto.po b/packages/volto/locales/es/LC_MESSAGES/volto.po index 5fc3fb54ff..ab8d24d7b8 100644 --- a/packages/volto/locales/es/LC_MESSAGES/volto.po +++ b/packages/volto/locales/es/LC_MESSAGES/volto.po @@ -3564,8 +3564,7 @@ msgid "Table" msgstr "Tabla" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "Tabla de contenidos" diff --git a/packages/volto/locales/eu/LC_MESSAGES/volto.po b/packages/volto/locales/eu/LC_MESSAGES/volto.po index 77b052e284..7315727083 100644 --- a/packages/volto/locales/eu/LC_MESSAGES/volto.po +++ b/packages/volto/locales/eu/LC_MESSAGES/volto.po @@ -3564,8 +3564,7 @@ msgid "Table" msgstr "Taula" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "Edukien taula" diff --git a/packages/volto/locales/fi/LC_MESSAGES/volto.po b/packages/volto/locales/fi/LC_MESSAGES/volto.po index 5db5c4cbee..b3e5eab26b 100644 --- a/packages/volto/locales/fi/LC_MESSAGES/volto.po +++ b/packages/volto/locales/fi/LC_MESSAGES/volto.po @@ -3562,8 +3562,7 @@ msgid "Table" msgstr "Taulukkoa" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "Sisällys" diff --git a/packages/volto/locales/fr/LC_MESSAGES/volto.po b/packages/volto/locales/fr/LC_MESSAGES/volto.po index 4887b87ff4..3dbd6b1441 100644 --- a/packages/volto/locales/fr/LC_MESSAGES/volto.po +++ b/packages/volto/locales/fr/LC_MESSAGES/volto.po @@ -3564,8 +3564,7 @@ msgid "Table" msgstr "Table" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "Table des matières" diff --git a/packages/volto/locales/hi/LC_MESSAGES/volto.po b/packages/volto/locales/hi/LC_MESSAGES/volto.po index ced8be4109..f6a27b1fb4 100644 --- a/packages/volto/locales/hi/LC_MESSAGES/volto.po +++ b/packages/volto/locales/hi/LC_MESSAGES/volto.po @@ -3557,8 +3557,7 @@ msgid "Table" msgstr "तालिका" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "सारांश की तालिका" diff --git a/packages/volto/locales/it/LC_MESSAGES/volto.po b/packages/volto/locales/it/LC_MESSAGES/volto.po index 060c5ba03e..f587cb69c3 100644 --- a/packages/volto/locales/it/LC_MESSAGES/volto.po +++ b/packages/volto/locales/it/LC_MESSAGES/volto.po @@ -3557,8 +3557,7 @@ msgid "Table" msgstr "Tabella" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "Indice dei contenuti" diff --git a/packages/volto/locales/ja/LC_MESSAGES/volto.po b/packages/volto/locales/ja/LC_MESSAGES/volto.po index 9a13ea1265..812b6610e8 100644 --- a/packages/volto/locales/ja/LC_MESSAGES/volto.po +++ b/packages/volto/locales/ja/LC_MESSAGES/volto.po @@ -3562,8 +3562,7 @@ msgid "Table" msgstr "テーブル" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "目次" diff --git a/packages/volto/locales/nl/LC_MESSAGES/volto.po b/packages/volto/locales/nl/LC_MESSAGES/volto.po index a7d79f4271..79434cb256 100644 --- a/packages/volto/locales/nl/LC_MESSAGES/volto.po +++ b/packages/volto/locales/nl/LC_MESSAGES/volto.po @@ -3561,8 +3561,7 @@ msgid "Table" msgstr "" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "" diff --git a/packages/volto/locales/pt/LC_MESSAGES/volto.po b/packages/volto/locales/pt/LC_MESSAGES/volto.po index 0c0d9f1b74..0e03fd8257 100644 --- a/packages/volto/locales/pt/LC_MESSAGES/volto.po +++ b/packages/volto/locales/pt/LC_MESSAGES/volto.po @@ -3562,8 +3562,7 @@ msgid "Table" msgstr "Tabela" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "" diff --git a/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po b/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po index 4957f58bff..b92a54201f 100644 --- a/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po +++ b/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po @@ -3563,8 +3563,7 @@ msgid "Table" msgstr "Tabela" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "Tabela de conteúdos" diff --git a/packages/volto/locales/ro/LC_MESSAGES/volto.po b/packages/volto/locales/ro/LC_MESSAGES/volto.po index 1eeefe866b..560650f769 100644 --- a/packages/volto/locales/ro/LC_MESSAGES/volto.po +++ b/packages/volto/locales/ro/LC_MESSAGES/volto.po @@ -3557,8 +3557,7 @@ msgid "Table" msgstr "Tabel" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "Cuprins" diff --git a/packages/volto/locales/volto.pot b/packages/volto/locales/volto.pot index a700a289e7..20790c41ab 100644 --- a/packages/volto/locales/volto.pot +++ b/packages/volto/locales/volto.pot @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: Plone\n" -"POT-Creation-Date: 2024-09-19T10:10:37.548Z\n" +"POT-Creation-Date: 2024-09-26T14:41:55.000Z\n" "Last-Translator: Plone i18n \n" "Language-Team: Plone i18n \n" "Content-Type: text/plain; charset=utf-8\n" @@ -3559,8 +3559,7 @@ msgid "Table" msgstr "" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "" diff --git a/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po b/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po index 26986f3cb8..63c9af1362 100644 --- a/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po +++ b/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po @@ -3563,8 +3563,7 @@ msgid "Table" msgstr "表格" #. Default: "Table of Contents" -#: components/manage/Blocks/ToC/variations/DefaultTocRenderer -#: components/manage/Blocks/ToC/variations/HorizontalMenu +#: components/manage/Blocks/ToC/View msgid "Table of Contents" msgstr "表格内容" diff --git a/packages/volto/news/6082.breaking b/packages/volto/news/6082.breaking new file mode 100644 index 0000000000..11bd0cc5a5 --- /dev/null +++ b/packages/volto/news/6082.breaking @@ -0,0 +1 @@ +Wrap Table of Contents block in a `nav` tag, instead of a `div` tag, for better representation improving the block accessibility. @Tishasoumya-02 @ichim-david diff --git a/packages/volto/src/components/manage/Blocks/ToC/View.jsx b/packages/volto/src/components/manage/Blocks/ToC/View.jsx index 6594cb9a6b..80596cd499 100644 --- a/packages/volto/src/components/manage/Blocks/ToC/View.jsx +++ b/packages/volto/src/components/manage/Blocks/ToC/View.jsx @@ -2,10 +2,9 @@ * View toc block. * @module components/manage/Blocks/ToC/View */ - import React from 'react'; import PropTypes from 'prop-types'; -import { injectIntl } from 'react-intl'; +import { FormattedMessage } from 'react-intl'; import cx from 'classnames'; import { Message } from 'semantic-ui-react'; import config from '@plone/volto/registry'; @@ -86,6 +85,8 @@ export const getBlocksTocEntries = (properties, tocData) => { */ const View = (props) => { const { data } = props; + + const title = data.title ? data.title : ''; const { variation } = props; const metadata = props.metadata || props.properties; const blocksFieldname = getBlocksFieldname(metadata); @@ -165,9 +166,19 @@ const View = (props) => { const Renderer = variation?.view; return ( -
- {props.mode === 'edit' && !data.title && !tocEntries.length && ( - Table of content +
+ ); }; @@ -188,4 +199,4 @@ View.propTypes = { properties: PropTypes.objectOf(PropTypes.any).isRequired, }; -export default injectIntl(withBlockExtensions(View)); +export default withBlockExtensions(View); diff --git a/packages/volto/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx b/packages/volto/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx index 9881a1dc38..ba15af9f23 100644 --- a/packages/volto/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +++ b/packages/volto/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx @@ -3,11 +3,9 @@ * @module components/manage/Blocks/ToC/View */ -import React from 'react'; import PropTypes from 'prop-types'; import { map } from 'lodash'; import { List } from 'semantic-ui-react'; -import { FormattedMessage, injectIntl } from 'react-intl'; import Slugger from 'github-slugger'; import { UniversalLink } from '@plone/volto/components'; import { normalizeString } from '@plone/volto/helpers'; @@ -45,18 +43,7 @@ const RenderListItems = ({ items, data }) => { const View = ({ data, tocEntries }) => { return ( <> - {data.title && !data.hide_title ? ( -

- {data.title || ( - - )} -

- ) : ( - '' - )} + {data.title && !data.hide_title ?

{data.title}

: ''} { return ( <> - {data.title && !data.hide_title ? ( -

- {data.title || ( - - )} -

- ) : ( - '' - )} + {data.title && !data.hide_title ?

{data.title}

: ''}