diff --git a/CHANGELOG.md b/CHANGELOG.md index 06bfbe2a1..a7c9a0efa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [3.0.0-beta8](https://github.com/openeuropa/oe_theme/tree/3.0.0-beta8) (2022-02-07) + +[Full Changelog](https://github.com/openeuropa/oe_theme/compare/3.0.0-beta7...3.0.0-beta8) + +**Closed issues:** + +- Navigation is displayed above the breadcrumb [\#1002](https://github.com/openeuropa/oe_theme/issues/1002) + +**Merged pull requests:** + +- EWPP-1888: Handle non-eu logos provided by ECL 3.2. [\#1011](https://github.com/openeuropa/oe_theme/pull/1011) ([yenyasinn](https://github.com/yenyasinn)) +- EWPP-1860: Prepending inpage nav ids with ref-. [\#1004](https://github.com/openeuropa/oe_theme/pull/1004) ([upchuk](https://github.com/upchuk)) +- EWPP-1854: Adapt HTML attributes to improve accessibility and behavior of the Logo link in header and footer. [\#1012](https://github.com/openeuropa/oe_theme/pull/1012) ([sergepavle](https://github.com/sergepavle)) +- EWPP-1585: Show calendar icon on the datepicker. [\#1010](https://github.com/openeuropa/oe_theme/pull/1010) ([yenyasinn](https://github.com/yenyasinn)) +- EWPP-1890: Update to ECL 3.2.0. [\#1008](https://github.com/openeuropa/oe_theme/pull/1008) ([22Alexandra](https://github.com/22Alexandra)) +- EWPP-1631: Contact "name" field should remain optional. [\#984](https://github.com/openeuropa/oe_theme/pull/984) ([yenyasinn](https://github.com/yenyasinn)) +- EPIC-EWPP-755-Highlighted [\#1005](https://github.com/openeuropa/oe_theme/pull/1005) ([22Alexandra](https://github.com/22Alexandra)) +- EWPP-1728: Define blocks for project results field group template. [\#992](https://github.com/openeuropa/oe_theme/pull/992) ([nagyad](https://github.com/nagyad)) + ## [3.0.0-beta7](https://github.com/openeuropa/oe_theme/tree/3.0.0-beta7) (2021-12-06) [Full Changelog](https://github.com/openeuropa/oe_theme/compare/3.0.0-beta6...3.0.0-beta7) diff --git a/js/inpage_navigation.js b/js/inpage_navigation.js index 845c4ed1e..d5f5ae958 100644 --- a/js/inpage_navigation.js +++ b/js/inpage_navigation.js @@ -136,6 +136,13 @@ return false; } + if (!slug[0].match("^[a-zA-Z]*$")) { + // In case the slug doesn't start with letters, append a string to + // ensure that the resulting slug is always a valid query selector. + slug = 'ref-' + slug; + originalSlug = slug; + } + // If an element with the generated slug as ID already exists, mark the slug as seen. if (!this.seenIds.hasOwnProperty(slug) && document.querySelector('#' + slug)) { this.seenIds[slug] = 0; diff --git a/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test-content.html.twig b/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test-content.html.twig index fcb85edc3..5097d0003 100644 --- a/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test-content.html.twig +++ b/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test-content.html.twig @@ -45,4 +45,6 @@ {# An element that will generate an ID that can represent a property of the Object prototype. #}

Length

+

2022, a new year

+ diff --git a/modules/oe_theme_helper/tests/src/FunctionalJavascript/InPageNavigationLibraryTest.php b/modules/oe_theme_helper/tests/src/FunctionalJavascript/InPageNavigationLibraryTest.php index d96b3d9ab..3afa29afc 100644 --- a/modules/oe_theme_helper/tests/src/FunctionalJavascript/InPageNavigationLibraryTest.php +++ b/modules/oe_theme_helper/tests/src/FunctionalJavascript/InPageNavigationLibraryTest.php @@ -66,7 +66,7 @@ public function testLibrary(): void { // container. // CSS selector uses "descendent-or-self" as prefix, so we need to use // XPath to exclude the container from the selection. - $this->assertCount(10, $container->findAll('xpath', '//*[@id]')); + $this->assertCount(11, $container->findAll('xpath', '//*[@id]')); $inner = $container->find('xpath', '/div[@data-inpage-navigation-source-area="h3"]'); // Since an element with ID "details" already exists in the page, the @@ -91,10 +91,12 @@ public function testLibrary(): void { // easier to assert the content. $this->assertEquals('Title with HTML tags', $container->find('xpath', '/h3[@id="title-with-html-tags"]')->getHtml()); - // Last 3 assertions for the ID generation. + // Last 4 assertions for the ID generation. $this->assertEquals('strip--unwanted-characters', $container->find('css', '.strip')->getAttribute('id')); $this->assertEquals('constructor', $container->find('xpath', '/h3[@class="heading"][text()="Reserved keyword"]')->getAttribute('id')); $this->assertEquals('length', $container->find('xpath', '/h3[@class="heading"][text()="Length"]')->getAttribute('id')); + // The heading starting with a non-alpha character gets a ref- prepended. + $this->assertEquals('ref-2022-a-new-year', $container->find('xpath', '/h3[@class="heading"][text()="2022, a new year"]')->getAttribute('id')); $navigation = $assert_session->elementExists('css', '#block-inpage-navigation nav[data-ecl-inpage-navigation]'); $assert = new InPageNavigationAssert(); @@ -137,6 +139,10 @@ public function testLibrary(): void { 'label' => 'Length', 'href' => '#length', ], + [ + 'label' => '2022, a new year', + 'href' => '#ref-2022-a-new-year', + ], ], ]; $assert->assertPattern($expected, $navigation->getOuterHtml()); diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-bg.po b/modules/oe_theme_helper/translations/oe_theme_helper-bg.po index a987df80c..badfe8672 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-bg.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-bg.po @@ -525,6 +525,18 @@ msgstr "защита на данните" msgid "Highlighted" msgstr "Акценти" +msgid "European Union flag" +msgstr "Знаме на Европейския съюз" + +msgid "European Commission logo" +msgstr "Лого на Европейската комисия" + +msgid "Home" +msgstr "Начало" + +msgid "European Union" +msgstr "Европейски съюз" + msgid "This event has been cancelled." msgstr "Тази проява е отменена." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-cs.po b/modules/oe_theme_helper/translations/oe_theme_helper-cs.po index b7ecc9b89..b85f1d304 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-cs.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-cs.po @@ -525,6 +525,18 @@ msgstr "ochrany údajů" msgid "Highlighted" msgstr "Důležité" +msgid "European Union flag" +msgstr "Vlajka Evropské unie" + +msgid "European Commission logo" +msgstr "Logo Evropské komise" + +msgid "Home" +msgstr "Úvod" + +msgid "European Union" +msgstr "Evropská unie" + msgid "This event has been cancelled." msgstr "Tato akce byla zrušena." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-da.po b/modules/oe_theme_helper/translations/oe_theme_helper-da.po index 12437190c..4ed3399ba 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-da.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-da.po @@ -525,6 +525,18 @@ msgstr "databeskyttelse" msgid "Highlighted" msgstr "Fremhævet" +msgid "European Union flag" +msgstr "EU-flaget" + +msgid "European Commission logo" +msgstr "Europa-Kommissionens logo" + +msgid "Home" +msgstr "Forside" + +msgid "European Union" +msgstr "Europæiske Unions" + msgid "This event has been cancelled." msgstr "Dette arrangement er aflyst." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-de.po b/modules/oe_theme_helper/translations/oe_theme_helper-de.po index 16027bfb0..7e805dce2 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-de.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-de.po @@ -525,6 +525,18 @@ msgstr "Datenschutzbestimmungen" msgid "Highlighted" msgstr "Hervorgehoben" +msgid "European Union flag" +msgstr "Flagge der Europäischen Union" + +msgid "European Commission logo" +msgstr "Logo der Europäischen Kommission" + +msgid "Home" +msgstr "Startseite" + +msgid "European Union" +msgstr "Europäische Union" + msgid "This event has been cancelled." msgstr "Diese Veranstaltung wurde abgesagt." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-el.po b/modules/oe_theme_helper/translations/oe_theme_helper-el.po index 38b82319b..7eba0e369 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-el.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-el.po @@ -525,6 +525,18 @@ msgstr "όρους προστασίας δεδομένων" msgid "Highlighted" msgstr "Με επισήμανση" +msgid "European Union flag" +msgstr "Σημαία της Ευρωπαϊκής Ένωσης" + +msgid "European Commission logo" +msgstr "Λογότυπος της Ευρωπαϊκής Επιτροπής" + +msgid "Home" +msgstr "Αρχική σελίδα" + +msgid "European Union" +msgstr "Ευρωπαϊκή Ένωση" + msgid "This event has been cancelled." msgstr "Η εκδήλωση αυτή έχει ματαιωθεί." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-es.po b/modules/oe_theme_helper/translations/oe_theme_helper-es.po index c21a5bef2..e72260e39 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-es.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-es.po @@ -525,6 +525,18 @@ msgstr "condiciones de protección de datos" msgid "Highlighted" msgstr "Destacado" +msgid "European Union flag" +msgstr "Bandera de la Unión Europea" + +msgid "European Commission logo" +msgstr "Logotipo de la Comisión Europea" + +msgid "Home" +msgstr "Inicio" + +msgid "European Union" +msgstr "Unión Europea" + msgid "This event has been cancelled." msgstr "Este evento se ha cancelado." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-et.po b/modules/oe_theme_helper/translations/oe_theme_helper-et.po index 22c9f6a84..3503ab31e 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-et.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-et.po @@ -525,6 +525,18 @@ msgstr "isikuandmete kaitse põhimõtetega" msgid "Highlighted" msgstr "Esiplaanil" +msgid "European Union flag" +msgstr "Euroopa Liidu lipp" + +msgid "European Commission logo" +msgstr "Euroopa Komisjoni logo" + +msgid "Home" +msgstr "Avaleht" + +msgid "European Union" +msgstr "Euroopa Liit" + msgid "This event has been cancelled." msgstr "See üritus on tühistatud." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-fi.po b/modules/oe_theme_helper/translations/oe_theme_helper-fi.po index 07cfbdc1e..003a93108 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-fi.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-fi.po @@ -525,6 +525,18 @@ msgstr "tietosuojaselosteen" msgid "Highlighted" msgstr "Valokeilassa" +msgid "European Union flag" +msgstr "Euroopan unionin lippu" + +msgid "European Commission logo" +msgstr "Euroopan komission logo" + +msgid "Home" +msgstr "Etusivu" + +msgid "European Union" +msgstr "Euroopan unioni" + msgid "This event has been cancelled." msgstr "Tämä tapahtuma on peruutettu." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-fr.po b/modules/oe_theme_helper/translations/oe_theme_helper-fr.po index 3f820b448..94d954ab9 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-fr.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-fr.po @@ -525,6 +525,18 @@ msgstr "conditions relatives à la protection des données" msgid "Highlighted" msgstr "Mis en évidence" +msgid "European Union flag" +msgstr "Drapeau de l'Union européenne" + +msgid "European Commission logo" +msgstr "Logo de la Commission européenne" + +msgid "Home" +msgstr "Accueil" + +msgid "European Union" +msgstr "Union européenne" + msgid "This event has been cancelled." msgstr "Cet événement a été annulé." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-ga.po b/modules/oe_theme_helper/translations/oe_theme_helper-ga.po index d1b9c3a79..927bdff80 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-ga.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-ga.po @@ -525,6 +525,18 @@ msgstr "téarmaí cosanta sonraí" msgid "Highlighted" msgstr "Aibhsithe" +msgid "European Union flag" +msgstr "Bratach an Aontais Eorpaigh" + +msgid "European Commission logo" +msgstr "Lógó an Choimisiúin Eorpaigh" + +msgid "Home" +msgstr "Baile" + +msgid "European Union" +msgstr "Aontais Eorpaigh" + msgid "This event has been cancelled." msgstr "Cuireadh an imeacht seo ar ceal." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-hr.po b/modules/oe_theme_helper/translations/oe_theme_helper-hr.po index d4ec178c6..c9a2eb90b 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-hr.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-hr.po @@ -525,6 +525,18 @@ msgstr "uvjete zaštite podataka" msgid "Highlighted" msgstr "Istaknuto" +msgid "European Union flag" +msgstr "Zastava Europske unije" + +msgid "European Commission logo" +msgstr "Logotip Europske komisije" + +msgid "Home" +msgstr "Početak" + +msgid "European Union" +msgstr "Europske unije" + msgid "This event has been cancelled." msgstr "Ovo je događanje otkazano." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-hu.po b/modules/oe_theme_helper/translations/oe_theme_helper-hu.po index fedf52342..7dd1f4c82 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-hu.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-hu.po @@ -525,6 +525,18 @@ msgstr "adatvédelmi nyilatkozatot," msgid "Highlighted" msgstr "Előtérben" +msgid "European Union flag" +msgstr "Az Európai Unió zászlaja" + +msgid "European Commission logo" +msgstr "Az Európai Bizottság logója" + +msgid "Home" +msgstr "Kezdőlap" + +msgid "European Union" +msgstr "Európai Unió" + msgid "This event has been cancelled." msgstr "Ezt a rendezvényt törölték." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-it.po b/modules/oe_theme_helper/translations/oe_theme_helper-it.po index 66e602d3c..d72b9a5c4 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-it.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-it.po @@ -525,6 +525,18 @@ msgstr "condizioni relative alla protezione dei dati" msgid "Highlighted" msgstr "Evidenziato" +msgid "European Union flag" +msgstr "Bandiera dell'Unione europea" + +msgid "European Commission logo" +msgstr "Logo della Commissione europea" + +msgid "Home" +msgstr "Homepage" + +msgid "European Union" +msgstr "Unione europea" + msgid "This event has been cancelled." msgstr "L'evento è stato annullato." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-lt.po b/modules/oe_theme_helper/translations/oe_theme_helper-lt.po index ff4937657..e5c58788a 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-lt.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-lt.po @@ -525,6 +525,18 @@ msgstr "Duomenų apsaugos sąlygas" msgid "Highlighted" msgstr "Paryškinta" +msgid "European Union flag" +msgstr "Europos Sąjungos vėliava" + +msgid "European Commission logo" +msgstr "Europos Komisijos logotipas" + +msgid "Home" +msgstr "Pradžios puslapis" + +msgid "European Union" +msgstr "Europos Sąjunga" + msgid "This event has been cancelled." msgstr "Renginys buvo atšauktas." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-lv.po b/modules/oe_theme_helper/translations/oe_theme_helper-lv.po index a25adfce4..929401f32 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-lv.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-lv.po @@ -525,6 +525,18 @@ msgstr "datu aizsardzības noteikumus" msgid "Highlighted" msgstr "Aktuāli" +msgid "European Union flag" +msgstr "Eiropas Savienības karogs" + +msgid "European Commission logo" +msgstr "Eiropas Komisijas logotips" + +msgid "Home" +msgstr "Sākumlapa" + +msgid "European Union" +msgstr "Eiropas Savienība" + msgid "This event has been cancelled." msgstr "Šis pasākums ir atcelts." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-mt.po b/modules/oe_theme_helper/translations/oe_theme_helper-mt.po index 21b211b78..a33e31cc1 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-mt.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-mt.po @@ -525,6 +525,18 @@ msgstr "mat-termini tal-protezzjoni tad-data" msgid "Highlighted" msgstr "Enfasizzat" +msgid "European Union flag" +msgstr "Bandiera tal-Unjoni Ewropea" + +msgid "European Commission logo" +msgstr "Logo tal-Kummissjoni Ewropea" + +msgid "Home" +msgstr "Paġna ewlenija" + +msgid "European Union" +msgstr "L-Unjoni Ewropea" + msgid "This event has been cancelled." msgstr "Dan l-avveniment ġie kkanċellat." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-nl.po b/modules/oe_theme_helper/translations/oe_theme_helper-nl.po index 24bae9031..56f1792ff 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-nl.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-nl.po @@ -525,6 +525,18 @@ msgstr "privacyverklaring" msgid "Highlighted" msgstr "Actueel" +msgid "European Union flag" +msgstr "Vlag van de Europese Unie" + +msgid "European Commission logo" +msgstr "Logo van de Europese Commissie" + +msgid "Home" +msgstr "Home" + +msgid "European Union" +msgstr "Europese Unie" + msgid "This event has been cancelled." msgstr "Dit evenement is geannuleerd." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-pl.po b/modules/oe_theme_helper/translations/oe_theme_helper-pl.po index 1447524f6..5d0f245d6 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-pl.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-pl.po @@ -525,6 +525,18 @@ msgstr "warunki ochrony danych" msgid "Highlighted" msgstr "Na pierwszym planie" +msgid "European Union flag" +msgstr "Flaga Unii Europejskiej" + +msgid "European Commission logo" +msgstr "Symbol graficzny Komisji Europejskiej" + +msgid "Home" +msgstr "Strona główna" + +msgid "European Union" +msgstr "Unia Europejska" + msgid "This event has been cancelled." msgstr "To wydarzenie zostało odwołane." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-pt-pt.po b/modules/oe_theme_helper/translations/oe_theme_helper-pt-pt.po index a18f704d4..da5ae204d 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-pt-pt.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-pt-pt.po @@ -525,6 +525,18 @@ msgstr "condições aplicáveis em matéria de proteção de dados" msgid "Highlighted" msgstr "Em destaque" +msgid "European Union flag" +msgstr "Bandeira da União Europeia" + +msgid "European Commission logo" +msgstr "Logótipo da Comissão Europeia" + +msgid "Home" +msgstr "Página principal" + +msgid "European Union" +msgstr "União Europeia" + msgid "This event has been cancelled." msgstr "Este evento foi anulado." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-ro.po b/modules/oe_theme_helper/translations/oe_theme_helper-ro.po index 83284b6ca..9fba438b5 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-ro.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-ro.po @@ -525,6 +525,18 @@ msgstr "prevederile referitoare la protecția datelor" msgid "Highlighted" msgstr "În prim-plan" +msgid "European Union flag" +msgstr "Drapelul Uniunii Europene" + +msgid "European Commission logo" +msgstr "Logoul Comisiei Europene" + +msgid "Home" +msgstr "Prima pagină" + +msgid "European Union" +msgstr "Uniunea Europeană" + msgid "This event has been cancelled." msgstr "Acest eveniment a fost anulat." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-sk.po b/modules/oe_theme_helper/translations/oe_theme_helper-sk.po index f96f59253..e088b5db8 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-sk.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-sk.po @@ -525,6 +525,18 @@ msgstr "ochrany údajov" msgid "Highlighted" msgstr "Hlavné témy" +msgid "European Union flag" +msgstr "Vlajka Európskej únie" + +msgid "European Commission logo" +msgstr "Logo Európskej komisie" + +msgid "Home" +msgstr "Domovská stránka" + +msgid "European Union" +msgstr "Európska únia" + msgid "This event has been cancelled." msgstr "Toto podujatie bolo zrušené." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-sl.po b/modules/oe_theme_helper/translations/oe_theme_helper-sl.po index 2f16ccd68..cab72f83c 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-sl.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-sl.po @@ -525,6 +525,18 @@ msgstr "varstvu podatkov" msgid "Highlighted" msgstr "Izpostavljeno" +msgid "European Union flag" +msgstr "Zastava Evropske unije" + +msgid "European Commission logo" +msgstr "Logotip Evropske komisije" + +msgid "Home" +msgstr "Domača stran" + +msgid "European Union" +msgstr "Evropska unija" + msgid "This event has been cancelled." msgstr "Dogodek je odpovedan." diff --git a/modules/oe_theme_helper/translations/oe_theme_helper-sv.po b/modules/oe_theme_helper/translations/oe_theme_helper-sv.po index 83535812c..b92c3807e 100644 --- a/modules/oe_theme_helper/translations/oe_theme_helper-sv.po +++ b/modules/oe_theme_helper/translations/oe_theme_helper-sv.po @@ -525,6 +525,18 @@ msgstr "skydd av personuppgifter" msgid "Highlighted" msgstr "I fokus" +msgid "European Union flag" +msgstr "EU-flaggan" + +msgid "European Commission logo" +msgstr "Europeiska kommissionens logotyp" + +msgid "Home" +msgstr "Start" + +msgid "European Union" +msgstr "Europeiska unionen" + msgid "This event has been cancelled." msgstr "Evenemanget har ställts in." diff --git a/oe_theme.theme b/oe_theme.theme index c7066ab6d..4ef81fafb 100644 --- a/oe_theme.theme +++ b/oe_theme.theme @@ -1237,19 +1237,41 @@ function oe_theme_preprocess_block(&$variables) { * Add required variables to follow ECL guidelines. */ function oe_theme_preprocess_block__system_branding_block(&$variables) { - $variables['site_logo_alt'] = !empty($variables['site_name']) ? - t('@site_name logo', ['@site_name' => $variables['site_name']]) : - ''; - - $route_options = ['absolute' => TRUE]; - $variables['site_logo_href'] = Url::fromRoute('', [], $route_options)->toString(); + if ($variables['ecl_component_library'] === 'ec') { + $variables['logo_aria_label'] = t('Home') . ' - ' . t('European Commission'); + $variables['site_logo_alt'] = t('European Commission logo'); + $variables['site_logo_title'] = t('European Commission'); + $site_logo_href = 'https://ec.europa.eu/info'; + } + else { + $variables['logo_aria_label'] = t('Home') . ' - ' . t('European Union'); + $variables['site_logo_alt'] = t('European Union flag'); + $variables['site_logo_title'] = t('European Union'); + $site_logo_href = 'https://european-union.europa.eu'; + } - // Ensure the site logo falls back to english version if the language is - // not EU language. + // Provide correct icon for non-eu languages. $language_code = \Drupal::languageManager()->getCurrentLanguage()->getId(); if (!EuropeanUnionLanguages::hasLanguage($language_code)) { - $variables['current_language_id'] = 'en'; + if ($language_code === 'nb') { + // Set correct icon for Norwegian language. + $variables['current_language_id'] = 'no'; + } + else { + // Check whether ECL provides a logo for the language. + $ecl_logo = DRUPAL_ROOT . '/' . drupal_get_path('theme', 'oe_theme') . '/dist/' . $variables['ecl_component_library'] . '/images/logo/'; + $ecl_logo .= $variables['ecl_component_library'] === 'eu' ? 'standard-version/positive/' : ''; + $ecl_logo .= 'logo-' . $variables['ecl_component_library'] . '--' . $language_code . '.svg'; + if (!file_exists($ecl_logo)) { + // Provide fallback "en" icon if language logo doesn't exist. + $variables['current_language_id'] = 'en'; + } + } + } + else { + $site_logo_href .= '/index_' . EuropeanUnionLanguages::getInternalLanguageCode($variables['current_language_id']); } + $variables['site_logo_href'] = $site_logo_href; } /** @@ -1680,13 +1702,17 @@ function oe_theme_preprocess_oe_corporate_blocks_eu_footer(array &$variables) { $variables['logo_description'] = t('Discover more on @link', [ '@link' => new FormattableMarkup('europa.eu', []), ]); - + $site_logo_href = 'https://european-union.europa.eu'; // Ensure the site logo falls back to english version if the language is // not EU language. $language_code = \Drupal::languageManager()->getCurrentLanguage()->getId(); if (!EuropeanUnionLanguages::hasLanguage($language_code)) { $variables['current_language_id'] = 'en'; } + else { + $site_logo_href .= '/index_' . EuropeanUnionLanguages::getInternalLanguageCode($variables['current_language_id']); + } + $variables['path'] = $site_logo_href; } /** diff --git a/package.json b/package.json index d594ac780..d29d246e7 100644 --- a/package.json +++ b/package.json @@ -14,53 +14,53 @@ "prepare": "patch-package" }, "dependencies": { - "@ecl/builder": "3.2.0", - "@ecl/preset-ec": "3.2.0", - "@ecl/preset-eu": "3.2.0", - "@ecl/preset-reset": "3.2.0", + "@ecl/builder": "3.2.2", + "@ecl/preset-ec": "3.2.2", + "@ecl/preset-eu": "3.2.2", + "@ecl/preset-reset": "3.2.2", "@ecl/stylelint-config": "0.2.1", - "@ecl/theme-ec": "3.2.0", - "@ecl/theme-eu": "3.2.0", - "@ecl/twig-component-accordion": "3.2.0", - "@ecl/twig-component-blockquote": "3.2.0", - "@ecl/twig-component-breadcrumb-core": "3.2.0", - "@ecl/twig-component-breadcrumb-standardised": "3.2.0", - "@ecl/twig-component-button": "3.2.0", - "@ecl/twig-component-card": "3.2.0", - "@ecl/twig-component-datepicker": "3.2.0", - "@ecl/twig-component-description-list": "3.2.0", - "@ecl/twig-component-expandable": "3.2.0", - "@ecl/twig-component-fact-figures": "3.2.0", - "@ecl/twig-component-file": "3.2.0", - "@ecl/twig-component-footer-core": "3.2.0", - "@ecl/twig-component-footer-standardised": "3.2.0", - "@ecl/twig-component-gallery": "3.2.0", - "@ecl/twig-component-hero-banner": "3.2.0", - "@ecl/twig-component-icon": "3.2.0", - "@ecl/twig-component-inpage-navigation": "3.2.0", - "@ecl/twig-component-language-list": "3.2.0", - "@ecl/twig-component-link": "3.2.0", - "@ecl/twig-component-label": "3.2.0", - "@ecl/twig-component-media-container": "3.2.0", - "@ecl/twig-component-menu": "3.2.0", - "@ecl/twig-component-message": "3.2.0", - "@ecl/twig-component-page-banner": "3.2.0", - "@ecl/twig-component-page-header-core": "3.2.0", - "@ecl/twig-component-page-header-standardised": "3.2.0", - "@ecl/twig-component-pagination": "3.2.0", - "@ecl/twig-component-radio": "3.2.0", - "@ecl/twig-component-search-form": "3.2.0", - "@ecl/twig-component-site-header-core": "3.2.0", - "@ecl/twig-component-site-header-standardised": "3.2.0", - "@ecl/twig-component-skip-link": "3.2.0", - "@ecl/twig-component-social-media-follow": "3.2.0", - "@ecl/twig-component-social-media-share": "3.2.0", - "@ecl/twig-component-table": "3.2.0", - "@ecl/twig-component-tag": "3.2.0", - "@ecl/twig-component-text-input": "3.2.0", - "@ecl/twig-component-timeline": "3.2.0", - "@ecl/vanilla-utility-background": "3.2.0", - "@ecl/vanilla-utility-border": "3.2.0", + "@ecl/theme-ec": "3.2.2", + "@ecl/theme-eu": "3.2.2", + "@ecl/twig-component-accordion": "3.2.2", + "@ecl/twig-component-blockquote": "3.2.2", + "@ecl/twig-component-breadcrumb-core": "3.2.2", + "@ecl/twig-component-breadcrumb-standardised": "3.2.2", + "@ecl/twig-component-button": "3.2.2", + "@ecl/twig-component-card": "3.2.2", + "@ecl/twig-component-datepicker": "3.2.2", + "@ecl/twig-component-description-list": "3.2.2", + "@ecl/twig-component-expandable": "3.2.2", + "@ecl/twig-component-fact-figures": "3.2.2", + "@ecl/twig-component-file": "3.2.2", + "@ecl/twig-component-footer-core": "3.2.2", + "@ecl/twig-component-footer-standardised": "3.2.2", + "@ecl/twig-component-gallery": "3.2.2", + "@ecl/twig-component-hero-banner": "3.2.2", + "@ecl/twig-component-icon": "3.2.2", + "@ecl/twig-component-inpage-navigation": "3.2.2", + "@ecl/twig-component-language-list": "3.2.2", + "@ecl/twig-component-link": "3.2.2", + "@ecl/twig-component-label": "3.2.2", + "@ecl/twig-component-media-container": "3.2.2", + "@ecl/twig-component-menu": "3.2.2", + "@ecl/twig-component-message": "3.2.2", + "@ecl/twig-component-page-banner": "3.2.2", + "@ecl/twig-component-page-header-core": "3.2.2", + "@ecl/twig-component-page-header-standardised": "3.2.2", + "@ecl/twig-component-pagination": "3.2.2", + "@ecl/twig-component-radio": "3.2.2", + "@ecl/twig-component-search-form": "3.2.2", + "@ecl/twig-component-site-header-core": "3.2.2", + "@ecl/twig-component-site-header-standardised": "3.2.2", + "@ecl/twig-component-skip-link": "3.2.2", + "@ecl/twig-component-social-media-follow": "3.2.2", + "@ecl/twig-component-social-media-share": "3.2.2", + "@ecl/twig-component-table": "3.2.2", + "@ecl/twig-component-tag": "3.2.2", + "@ecl/twig-component-text-input": "3.2.2", + "@ecl/twig-component-timeline": "3.2.2", + "@ecl/vanilla-utility-background": "3.2.2", + "@ecl/vanilla-utility-border": "3.2.2", "chokidar-cli": "1.2.0", "grunt": "^1.4.0", "grunt-contrib-copy": "^1.0.0", diff --git a/patches/@ecl/twig-component-card+3.2.0.patch b/patches/@ecl/twig-component-card+3.2.2.patch similarity index 100% rename from patches/@ecl/twig-component-card+3.2.0.patch rename to patches/@ecl/twig-component-card+3.2.2.patch diff --git a/patches/@ecl/twig-component-footer-core+3.1.2.patch b/patches/@ecl/twig-component-footer-core+3.1.2.patch new file mode 100644 index 000000000..39a57ab30 --- /dev/null +++ b/patches/@ecl/twig-component-footer-core+3.1.2.patch @@ -0,0 +1,21 @@ +patch-package +--- a/node_modules/@ecl/twig-component-footer-core/footer-core.html.twig ++++ b/node_modules/@ecl/twig-component-footer-core/footer-core.html.twig +@@ -5,6 +5,8 @@ + - "rows" (array of objects) (default: []) + - "logo" + - "alt" (string) alt attribute for the logo link ++ - "aria_label" (string) aria-label attribute for the logo link ++ - "title" (string) title attribute for the logo img + - "path" (string) logo link path + - "language" (string) Language code + - "src_mobile" (string) Path the mobile logo (only for EU) +@@ -91,7 +93,7 @@ + path: _sections.logo.path, + label: _label, + type: 'standalone', +- aria_label: _sections.logo.title ++ aria_label: _sections.logo.aria_label, + }, + extra_classes: 'ecl-footer-core__logo-link' + } only %} diff --git a/patches/@ecl/twig-component-footer-standardised+3.2.0.patch b/patches/@ecl/twig-component-footer-standardised+3.2.0.patch deleted file mode 100644 index 42f6cb56f..000000000 --- a/patches/@ecl/twig-component-footer-standardised+3.2.0.patch +++ /dev/null @@ -1,11 +0,0 @@ -patch-package ---- a/node_modules/@ecl/twig-component-footer-standardised/footer-standardised.html.twig -+++ b/node_modules/@ecl/twig-component-footer-standardised/footer-standardised.html.twig -@@ -131,6 +131,7 @@ - {% endif %} - {% include '@ecl/link/link.html.twig' with _item|merge({ - link: _item.link|default({})|merge({ type: 'standalone' }), -+ icon: _item.icon|default({})|merge({ size: 'xs' }), - extra_classes: 'ecl-footer-standardised__link', - }) only %} - {% if _item.content_after is defined and _item.content_after is not empty %} diff --git a/patches/@ecl/twig-component-footer-standardised+3.2.2.patch b/patches/@ecl/twig-component-footer-standardised+3.2.2.patch new file mode 100644 index 000000000..5b3f3b4a1 --- /dev/null +++ b/patches/@ecl/twig-component-footer-standardised+3.2.2.patch @@ -0,0 +1,29 @@ +patch-package +--- a/node_modules/@ecl/twig-component-footer-standardised/footer-standardised.html.twig ++++ b/node_modules/@ecl/twig-component-footer-standardised/footer-standardised.html.twig +@@ -6,6 +6,8 @@ + - "section_class_name" (string) (default: '') + - "logo" (EU only) + - "alt" (string) alt attribute for the logo link ++ - "aria_label" (string) aria-label attribute for the logo link ++ - "title" (string) title attribute for the logo img + - "path" (string) logo link path + - "language" (string) Language code + - "src_mobile" (string) Path the mobile logo +@@ -88,7 +90,7 @@ + path: _sections.logo.path, + label: _label, + type: 'standalone', +- aria_label: _sections.logo.title ++ aria_label: _sections.logo.aria_label, + }, + extra_classes: 'ecl-footer-standardised__logo-link' + } only %} +@@ -133,6 +135,7 @@ + {% endif %} + {% include '@ecl/link/link.html.twig' with _item|merge({ + link: _item.link|default({})|merge({ type: 'standalone' }), ++ icon: _item.icon|default({})|merge({ size: 'xs' }), + extra_classes: 'ecl-footer-standardised__link', + }) only %} + {% if _item.content_after is defined and _item.content_after is not empty %} diff --git a/patches/@ecl/twig-component-table+3.2.0.patch b/patches/@ecl/twig-component-table+3.2.2.patch similarity index 100% rename from patches/@ecl/twig-component-table+3.2.0.patch rename to patches/@ecl/twig-component-table+3.2.2.patch diff --git a/templates/blocks/block--system-branding-block.html.twig b/templates/blocks/block--system-branding-block.html.twig index 7f5979e3d..62a8d91f9 100644 --- a/templates/blocks/block--system-branding-block.html.twig +++ b/templates/blocks/block--system-branding-block.html.twig @@ -10,25 +10,25 @@ {% if ecl_component_library == 'eu' %} {{ site_logo_alt }} {{ site_logo_alt }} {% else %} {{ site_logo_alt }} diff --git a/templates/navigation/oe-corporate-blocks-eu-footer--core.html.twig b/templates/navigation/oe-corporate-blocks-eu-footer--core.html.twig index 26bf78b93..dc79ba82b 100644 --- a/templates/navigation/oe-corporate-blocks-eu-footer--core.html.twig +++ b/templates/navigation/oe-corporate-blocks-eu-footer--core.html.twig @@ -15,10 +15,13 @@ [ { 'logo': { - 'path': 'https://europa.eu/', + 'path': path, 'language': current_language_id, 'src_mobile': ecl_logo_path ~ '/condensed-version/positive/logo-eu--' ~ current_language_id|to_internal_language_id ~ '.svg', 'src_desktop': ecl_logo_path ~ '/standard-version/positive/logo-eu--' ~ current_language_id|to_internal_language_id ~ '.svg', + 'title': 'European Union'|t, + 'alt': 'European Union flag'|t, + 'aria_label': 'Home'|t ~ ' - ' ~ 'European Union'|t, }, 'description': site_owner ? 'This site is managed by the European Commission, @name'|t({'@name': site_owner}), }, diff --git a/templates/navigation/oe-corporate-blocks-eu-footer--standardised.html.twig b/templates/navigation/oe-corporate-blocks-eu-footer--standardised.html.twig index 1b3b77891..175896309 100644 --- a/templates/navigation/oe-corporate-blocks-eu-footer--standardised.html.twig +++ b/templates/navigation/oe-corporate-blocks-eu-footer--standardised.html.twig @@ -35,10 +35,13 @@ [ { 'logo': { - 'path': 'https://europa.eu/', + 'path': path, 'language': current_language_id, 'src_mobile': ecl_logo_path ~ '/condensed-version/positive/logo-eu--' ~ current_language_id|to_internal_language_id ~ '.svg', 'src_desktop': ecl_logo_path ~ '/standard-version/positive/logo-eu--' ~ current_language_id|to_internal_language_id ~ '.svg', + 'title': 'European Union'|t, + 'alt': 'European Union flag'|t, + 'aria_label': 'Home'|t ~ ' - ' ~ 'European Union'|t, }, 'description': logo_description, }, diff --git a/tests/features/site-branding.feature b/tests/features/site-branding.feature index 0922c18cc..1c4f3062f 100644 --- a/tests/features/site-branding.feature +++ b/tests/features/site-branding.feature @@ -4,24 +4,27 @@ Feature: Site branding As a product owner I want to make sure that all necessary site branding features are provided by the OpenEuropa Theme. - @javascript @enable-non-eu-language @wip + @javascript @enable-non-eu-language Scenario Outline: The European Commission logo is available throughout the site. Given I am on the homepage When the theme is configured to use the "European Union" style And I reload the page Then I should see the "logo" element in the "header" - And the "English" EU mobile logo should be available When I open the language switcher dialog And I click "" Then the "" EU mobile logo should be available + And the "" header logo should contain accessibility attributes When the theme is configured to use the "European Commission" style And I reload the page Then I should see the "logo" element in the "header" + And the "" header logo should contain accessibility attributes When I am on "the user registration page" Then I should see the "logo" element in the "header" + And the "English" header logo should contain accessibility attributes Examples: | language_selector | language | + | English | English | | български | Bulgarian | | español | Spanish | | čeština | Czech | @@ -46,7 +49,7 @@ Feature: Site branding | suomi | Finnish | | svenska | Swedish | # Non-EU language. - | Icelandic | English | + | Icelandic | Icelandic | @javascript @enable-non-eu-language Scenario: The European Union logo is available in the footer when non-EU language is selected. diff --git a/tests/src/Behat/OeThemeTestContext.php b/tests/src/Behat/OeThemeTestContext.php index 85b5f2ed6..57a592296 100644 --- a/tests/src/Behat/OeThemeTestContext.php +++ b/tests/src/Behat/OeThemeTestContext.php @@ -9,7 +9,9 @@ use Drupal\DrupalExtension\Context\RawDrupalContext; use Drupal\field\Entity\FieldConfig; use Drupal\node\NodeInterface; +use Drupal\oe_theme_helper\EuropeanUnionLanguages; use Drupal\Tests\oe_theme\Behat\Traits\UtilityTrait; +use PHPUnit\Framework\Assert; /** * Behat step definitions related to the oe_theme_test module. @@ -364,6 +366,15 @@ public function assertFooter(string $component_library, bool $presence): void { $expectation = $presence ? 'present' : 'absent'; throw new \Exception("The {$component_library} corporate footer block was expected to be {$expectation} but it is not."); } + + if ($logo && $presence) { + $link = $page->find('css', '.ecl-footer-' . $this->getEclBranding() . '__logo-link'); + Assert::assertEquals('https://european-union.europa.eu/index_en', $link->getAttribute('href')); + Assert::assertEquals(t('Home - European Union')->__toString(), $link->getAttribute('aria-label')); + $img = $link->find('css', 'img'); + Assert::assertEquals(t('European Union flag')->__toString(), $img->getAttribute('alt')); + Assert::assertEquals(t('European Union')->__toString(), $img->getAttribute('title')); + } } /** @@ -372,34 +383,49 @@ public function assertFooter(string $component_library, bool $presence): void { * @Then the :language EU mobile logo should be available */ public function assertEuMobileLogo(string $language): void { - $lang_code = [ - 'Bulgarian' => 'bg', - 'Czech' => 'cs', - 'Danish' => 'da', - 'German' => 'de', - 'Estonian' => 'et', - 'Greek' => 'el', - 'English' => 'en', - 'Spanish' => 'es', - 'French' => 'fr', - 'Irish' => 'ga', - 'Croatian' => 'hr', - 'Italian' => 'it', - 'Latvian' => 'lv', - 'Lithuanian' => 'lt', - 'Hungarian' => 'hu', - 'Maltese' => 'mt', - 'Dutch' => 'nl', - 'Polish' => 'pl', - 'Portuguese' => 'pt', - 'Romanian' => 'ro', - 'Slovak' => 'sk', - 'Slovenian' => 'sl', - 'Finnish' => 'fi', - 'Swedish' => 'sv', + $lang_code = $this->getEuLanguages(); + $available_non_eu_logos = [ + 'Turkish' => 'tr', + 'Icelandic' => 'is', + 'Catalan' => 'ca', + 'Arabic' => 'ar', + 'Norwegian' => 'no', ]; + $lang_code = array_merge($lang_code, $available_non_eu_logos); + $langcode = $lang_code[$language] ?? 'en'; $this->assertSession()->elementExists('css', 'img.ecl-site-header-' . $this->getEclBranding() . '__logo-image-mobile'); - $this->assertSession()->elementAttributeContains('css', 'img.ecl-site-header-' . $this->getEclBranding() . '__logo-image-mobile', 'src', 'oe_theme/dist/eu/images/logo/condensed-version/positive/' . $lang_code[$language] . '.svg'); + $this->assertSession()->elementAttributeContains('css', 'img.ecl-site-header-' . $this->getEclBranding() . '__logo-image-mobile', 'src', 'oe_theme/dist/eu/images/logo/condensed-version/positive/logo-eu--' . $langcode . '.svg'); + } + + /** + * Asserts that the header logo contains all required attributes. + * + * @Then the :language header logo should contain accessibility attributes + */ + public function assertHeaderLogoAccessibility(string $language): void { + $theme_name = \Drupal::theme()->getActiveTheme()->getName(); + $component_library = \Drupal::config($theme_name . '.settings')->get('component_library'); + $eu_official_languages = $this->getEuLanguages(); + + $link_selector = '.ecl-site-header-' . $this->getEclBranding() . '__logo-link'; + $link = $this->getSession()->getPage()->find('css', $link_selector); + if ($component_library === 'ec') { + $href = !empty($eu_official_languages[$language]) ? 'https://ec.europa.eu/info/index_' . $eu_official_languages[$language] : 'https://ec.europa.eu/info'; + $aria_label = t('Home - European Commission')->__toString(); + $img_alt = t('European Commission logo')->__toString(); + $img_title = t('European Commission')->__toString(); + } + else { + $href = !empty($eu_official_languages[$language]) ? 'https://european-union.europa.eu/index_' . $eu_official_languages[$language] : 'https://european-union.europa.eu'; + $aria_label = t('Home - European Union')->__toString(); + $img_alt = t('European Union flag')->__toString(); + $img_title = t('European Union')->__toString(); + } + Assert::assertEquals($href, $link->getAttribute('href')); + Assert::assertEquals($aria_label, $link->getAttribute('aria-label')); + $img = $link->find('css', 'img'); + Assert::assertEquals($img_alt, $img->getAttribute('alt')); + Assert::assertEquals($img_title, $img->getAttribute('title')); } /** @@ -473,4 +499,15 @@ public function setEclBranding(string $ecl_branding): void { \Drupal::service('cache_tags.invalidator')->resetCheckSums(); } + /** + * Get the list of EU official language lang codes keyed by language name. + * + * @return array|false + * Array of languages keyed by language name. + */ + protected function getEuLanguages() { + $eu_languages = EuropeanUnionLanguages::getLanguageList(); + return array_combine(array_column($eu_languages, 0), array_column($eu_languages, 2)); + } + }