Skip to content

Commit 0c4e96f

Browse files
authored
Merge pull request #197 from BeAPI/feat/a11y-slider
feat(slider): add accessible Swiper carousel foundation
2 parents 0ed011d + 9ee535f commit 0c4e96f

14 files changed

Lines changed: 486 additions & 158 deletions

‎.eslintrc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"plugins": [
77
"prettier"
88
],
9+
"env": {
10+
"browser": true
11+
},
912
"globals": {
1013
"jQuery": true,
1114
"wp": true
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/**
4+
* Swiper Controls
5+
* Swiper add/replace automatically the aria-label, the role, the icon on the buttons
6+
*
7+
* @var array $args
8+
*/
9+
10+
?>
11+
12+
<div class="swiper__controls">
13+
<div class="swiper__buttons">
14+
<div class="swiper-button-prev swiper__button" role="button" aria-label="<?php esc_attr_e( 'Previous slide', 'beapi-blocks-theme' ); ?>"></div>
15+
<div class="swiper-button-next swiper__button" role="button" aria-label="<?php esc_attr_e( 'Next slide', 'beapi-blocks-theme' ); ?>"></div>
16+
</div>
17+
</div>

‎inc/Services/Assets.php‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function register_assets(): void {
8888
$this->assets_tools->register_script(
8989
'scripts',
9090
$asset['file'],
91-
array_merge( [ 'jquery' ], $asset['dependencies'] ), // ensure jQuery dependency is set even if not declared explicitly in the JS
91+
array_merge( [ 'jquery', 'wp-i18n' ], $asset['dependencies'] ), // ensure jQuery dependency is set even if not declared explicitly in the JS
9292
$asset['version'],
9393
[ 'strategy' => 'defer' ]
9494
);
@@ -127,6 +127,12 @@ public function register_assets(): void {
127127
public function enqueue_scripts(): void {
128128
// JS
129129
$this->assets_tools->enqueue_script( 'scripts' );
130+
131+
wp_set_script_translations(
132+
'scripts',
133+
'beapi-blocks-theme',
134+
\get_theme_file_path( 'languages' )
135+
);
130136
}
131137

132138
/**
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"translation-revision-date":"2026-04-10 16:29+0200","generator":"WP-CLI\/2.12.0","source":"dist\/app-min.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fr_FR","plural-forms":"nplurals=2; plural=(n > 1);"},"Previous slide":["Diapositive pr\u00e9c\u00e9dente"],"Next slide":["Diapositive suivante"],"This is the first slide":["C'est la premi\u00e8re diapositive"],"This is the last slide":["C'est la derni\u00e8re diapositive"],"Go to slide {{index}}":["Aller \u00e0 la diapositive {{index}}"],"{{index}} of {{slidesLength}}":["{{index}} sur {{slidesLength}}"]}}}
-15 Bytes
Binary file not shown.

‎languages/beapi-blocks-theme-fr_FR.po‎

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
# Copyright (C) 2025 BeAPI
2-
# This file is distributed under the same license as the BeAPI Blocks Theme theme.
31
msgid ""
42
msgstr ""
53
"Project-Id-Version: BeAPI Blocks Theme 1.0\n"
6-
"Report-Msgid-Bugs-To: https://wordpress.org/support/theme/beapi-blocks-"
7-
"theme\n"
8-
"POT-Creation-Date: 2026-04-10T14:28:33+00:00\n"
9-
"PO-Revision-Date: 2026-04-10 16:29+0200\n"
4+
"Report-Msgid-Bugs-To: https://wordpress.org/support/theme/beapi-blocks-theme\n"
105
"Last-Translator: \n"
116
"Language-Team: \n"
12-
"Language: fr_FR\n"
137
"MIME-Version: 1.0\n"
148
"Content-Type: text/plain; charset=UTF-8\n"
159
"Content-Transfer-Encoding: 8bit\n"
10+
"POT-Creation-Date: 2026-04-10T14:28:33+00:00\n"
11+
"PO-Revision-Date: 2026-04-10 16:29+0200\n"
12+
"Language: fr_FR\n"
1613
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
1714
"X-Generator: Poedit 3.8\n"
1815
"X-Domain: beapi-blocks-theme\n"
1916

2017
#. Theme Name of the theme
2118
#. Description of the theme
22-
#: style.css patterns/footer.php:75
19+
#: style.css
20+
#: patterns/footer.php:75
2321
msgid "BeAPI Blocks Theme"
2422
msgstr ""
2523

@@ -34,7 +32,8 @@ msgid "BeAPI"
3432
msgstr ""
3533

3634
#. Author URI of the theme
37-
#: style.css patterns/footer.php:83
35+
#: style.css
36+
#: patterns/footer.php:83
3837
msgid "https://beapi.fr"
3938
msgstr ""
4039

@@ -173,7 +172,8 @@ msgstr "Voici plutôt quelques liens utiles :"
173172
msgid "Back to home"
174173
msgstr "Retour à l’accueil"
175174

176-
#: patterns/hidden-404.php:41 patterns/hidden-404.php:45
175+
#: patterns/hidden-404.php:41
176+
#: patterns/hidden-404.php:45
177177
msgid "Link"
178178
msgstr "Lien"
179179

@@ -381,3 +381,29 @@ msgstr ""
381381

382382
#~ msgid "Add to my calendar"
383383
#~ msgstr "Ajouter à mon calendrier"
384+
385+
#: components/parts/common/swiper-controls.php:14
386+
#: dist/app-min.js
387+
msgid "Previous slide"
388+
msgstr "Diapositive précédente"
389+
390+
#: components/parts/common/swiper-controls.php:15
391+
#: dist/app-min.js
392+
msgid "Next slide"
393+
msgstr "Diapositive suivante"
394+
395+
#: dist/app-min.js
396+
msgid "This is the first slide"
397+
msgstr "C'est la première diapositive"
398+
399+
#: dist/app-min.js
400+
msgid "This is the last slide"
401+
msgstr "C'est la dernière diapositive"
402+
403+
#: dist/app-min.js
404+
msgid "Go to slide {{index}}"
405+
msgstr "Aller à la diapositive {{index}}"
406+
407+
#: dist/app-min.js
408+
msgid "{{index}} of {{slidesLength}}"
409+
msgstr "{{index}} sur {{slidesLength}}"

‎languages/beapi-blocks-theme.pot‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,3 +336,29 @@ msgstr ""
336336
msgctxt "Template part name"
337337
msgid "Footer"
338338
msgstr ""
339+
340+
#: components/parts/common/swiper-controls.php:14
341+
#: dist/app-min.js
342+
msgid "Previous slide"
343+
msgstr ""
344+
345+
#: components/parts/common/swiper-controls.php:15
346+
#: dist/app-min.js
347+
msgid "Next slide"
348+
msgstr ""
349+
350+
#: dist/app-min.js
351+
msgid "This is the first slide"
352+
msgstr ""
353+
354+
#: dist/app-min.js
355+
msgid "This is the last slide"
356+
msgstr ""
357+
358+
#: dist/app-min.js
359+
msgid "Go to slide {{index}}"
360+
msgstr ""
361+
362+
#: dist/app-min.js
363+
msgid "{{index}} of {{slidesLength}}"
364+
msgstr ""

0 commit comments

Comments
 (0)