Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a11y logo issue #5776

Merged
merged 21 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/volto/locales/ca/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,7 @@ msgstr "Historial de {title}"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Inici"

Expand Down Expand Up @@ -2059,6 +2060,11 @@ msgstr "Error a l'iniciar sessió"
msgid "Login Name"
msgstr "Nom d'usuari"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,7 @@ msgstr "Historie von {title}"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Startseite"

Expand Down Expand Up @@ -2058,6 +2059,11 @@ msgstr "Login fehlgeschlagen"
msgid "Login Name"
msgstr "Benutzername"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr "Logo von"

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,7 @@ msgstr ""
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr ""

Expand Down Expand Up @@ -2053,6 +2054,11 @@ msgstr ""
msgid "Login Name"
msgstr ""

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,7 @@ msgstr "Historial de {title}"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Inicio"

Expand Down Expand Up @@ -2060,6 +2061,11 @@ msgstr "Inicio de Sesión fallo"
msgid "Login Name"
msgstr "Nombre de usuario"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/eu/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,7 @@ msgstr "{title} elementuaren historia"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Hasiera"

Expand Down Expand Up @@ -2060,6 +2061,11 @@ msgstr "Sartzeak huts egin du"
msgid "Login Name"
msgstr "Erabiltzaile-izena"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/fi/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,7 @@ msgstr "{title} – muutoshistoria"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Etusivu"

Expand Down Expand Up @@ -2058,6 +2059,11 @@ msgstr "Kirjautuminen epäonnistui"
msgid "Login Name"
msgstr "Tunnus"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,7 @@ msgstr "Historique de {title}"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Accueil"

Expand Down Expand Up @@ -2060,6 +2061,11 @@ msgstr "Echec de la connexion"
msgid "Login Name"
msgstr "Identifiant"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,7 @@ msgstr "Cronologia di {title}"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Home"

Expand Down Expand Up @@ -2053,6 +2054,11 @@ msgstr "Accesso fallito"
msgid "Login Name"
msgstr "Nome utente"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/ja/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,7 @@ msgstr "{title} の履歴"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "ホーム"

Expand Down Expand Up @@ -2058,6 +2059,11 @@ msgstr "ログインに失敗しました"
msgid "Login Name"
msgstr "ログイン名"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/nl/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,7 @@ msgstr "Geschiedenis van {title}"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Home"

Expand Down Expand Up @@ -2057,6 +2058,11 @@ msgstr ""
msgid "Login Name"
msgstr "Gebruikersnaam"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/pt/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,7 @@ msgstr "Histórico de {title}"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Início"

Expand Down Expand Up @@ -2058,6 +2059,11 @@ msgstr "Falhou o início de sessão"
msgid "Login Name"
msgstr "Nome de utilizador"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/pt_BR/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,7 @@ msgstr "Histórico de {title}"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Início"

Expand Down Expand Up @@ -2059,6 +2060,11 @@ msgstr "Falha na autenticação"
msgid "Login Name"
msgstr "Nome de usuário"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/ro/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,7 @@ msgstr "Istoricul {title}"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "Acasă"

Expand Down Expand Up @@ -2053,6 +2054,11 @@ msgstr "Autentificare eșuată"
msgid "Login Name"
msgstr "Nume de autentificare"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
8 changes: 7 additions & 1 deletion packages/volto/locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2024-01-12T09:21:12.378Z\n"
"POT-Creation-Date: 2024-02-26T09:23:35.781Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down Expand Up @@ -1668,6 +1668,7 @@ msgstr ""
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr ""

Expand Down Expand Up @@ -2055,6 +2056,11 @@ msgstr ""
msgid "Login Name"
msgstr ""

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
6 changes: 6 additions & 0 deletions packages/volto/locales/zh_CN/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,7 @@ msgstr "历史{title}"
#: components/manage/Contents/ContentsBreadcrumbs
#: components/manage/Contents/ContentsBreadcrumbsHomeItem
#: components/theme/Breadcrumbs/Breadcrumbs
#: components/theme/Logo/Logo
msgid "Home"
msgstr "首页"

Expand Down Expand Up @@ -2059,6 +2060,11 @@ msgstr "登陆失败"
msgid "Login Name"
msgstr "登录名"

#. Default: "Logo of"
#: components/theme/Logo/Logo
msgid "Logo of"
msgstr ""

#. Default: "Logout"
#: components/manage/Toolbar/PersonalTools
msgid "Logout"
Expand Down
1 change: 1 addition & 0 deletions packages/volto/news/5776.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved accessibility of logo component. @Molochem
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Multilingual Logo', () => {
},
},
site: {
data: {},
data: { 'plone.site_title': 'Plone Site' },
},
});
const component = renderer.create(
Expand Down Expand Up @@ -95,6 +95,7 @@ describe('Multilingual Logo', () => {
data: {
'plone.site_logo':
'http://localhost:3000/@@site-logo/logo.cab945d8.svg',
'plone.site_title': 'Plone Site',
},
},
});
Expand Down Expand Up @@ -128,6 +129,7 @@ describe('Multilingual Logo', () => {
data: {
'plone.site_logo':
'http://localhost:3000/@@site-logo/logo.cab945d8.svg',
'plone.site_title': 'Plone Site',
},
},
});
Expand Down
30 changes: 18 additions & 12 deletions packages/volto/src/components/theme/Logo/Logo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* Logo component.
* @module components/theme/Logo/Logo
*/
import { defineMessages, useIntl } from 'react-intl';
import { useEffect } from 'react';
import { Image } from 'semantic-ui-react';
import { ConditionalLink } from '@plone/volto/components';
import LogoImage from '@plone/volto/components/theme/Logo/Logo.svg';
import { useSelector, useDispatch } from 'react-redux';
import { useLocation } from 'react-router-dom';
Expand All @@ -26,6 +26,18 @@ const Logo = () => {
const site = useSelector((state) => state.site.data);
const navroot = useSelector((state) => state.navroot.data);
const dispatch = useDispatch();
const intl = useIntl();

const messages = defineMessages({
home: {
id: 'Home',
defaultMessage: 'Home',
},
logoOf: {
id: 'Logo of',
defaultMessage: 'Logo of',
},
});

useEffect(() => {
if (pathname && !hasApiExpander('navroot', getBaseUrl(pathname))) {
Expand All @@ -34,26 +46,20 @@ const Logo = () => {
}, [dispatch, pathname]);

const navRootPath = flattenToAppURL(navroot?.navroot?.['@id']) || '/';
const currentURLIsNavRoot = pathname !== navRootPath;

return (
<ConditionalLink
href={navRootPath}
title={navroot?.navroot?.title}
// In case that the content returns 404, there is no information about the portal
// then render the link anyways to get out of the Unauthorized page
condition={!navroot || currentURLIsNavRoot}
>
<a href={navRootPath} aria-label={intl.formatMessage(messages.home)}>
Molochem marked this conversation as resolved.
Show resolved Hide resolved
<Image
src={
site['plone.site_logo']
? flattenToAppURL(site['plone.site_logo'])
: LogoImage
}
alt={navroot?.navroot?.title}
title={navroot?.navroot?.title}
alt={
intl.formatMessage(messages.logoOf) + ' ' + site['plone.site_title']
}
/>
</ConditionalLink>
</a>
);
};

Expand Down
Loading
Loading