From 155c0790d79659c4f47e9f42209de4e87ff0b5a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Andrietti?= Date: Mon, 27 Apr 2026 10:37:11 +0200 Subject: [PATCH] feat: remove a11y for blocks (added by beapi accessibility plugin) --- src/js/classes/ImageBlock.js | 32 ------------------------------ src/js/classes/TableBlock.js | 38 ------------------------------------ src/js/index.js | 2 -- 3 files changed, 72 deletions(-) delete mode 100644 src/js/classes/ImageBlock.js delete mode 100644 src/js/classes/TableBlock.js diff --git a/src/js/classes/ImageBlock.js b/src/js/classes/ImageBlock.js deleted file mode 100644 index 63f582b5..00000000 --- a/src/js/classes/ImageBlock.js +++ /dev/null @@ -1,32 +0,0 @@ -import AbstractDomElement from './AbstractDomElement' - -// ---- -// class -// ---- -class ImageBlock extends AbstractDomElement { - constructor(element, options) { - const instance = super(element, options) - - // avoid double init : - if (!instance.isNewInstance()) { - return instance - } - - const el = this._element - const figure = el.closest('.wp-block-image') - - // Add role="figure" and aria-label with the figure text to comply with RGAA criteria 1.9.1 : https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/#1.9 - figure.setAttribute('role', 'figure') - figure.setAttribute('aria-label', el.textContent) - } -} - -// ---- -// init -// ---- -ImageBlock.init('.wp-block-image figcaption') - -// ---- -// export -// ---- -export default ImageBlock diff --git a/src/js/classes/TableBlock.js b/src/js/classes/TableBlock.js deleted file mode 100644 index 3aa98ba8..00000000 --- a/src/js/classes/TableBlock.js +++ /dev/null @@ -1,38 +0,0 @@ -import AbstractDomElement from './AbstractDomElement' - -// ---- -// class -// ---- -class TableBlock extends AbstractDomElement { - constructor(element, options) { - const instance = super(element, options) - - // avoid double init : - if (!instance.isNewInstance()) { - return instance - } - - const el = this._element - const table = el.querySelector('table') - const thead = table.querySelector('thead') - - // Tableau de données - if (thead) { - const ths = thead.querySelectorAll('th') - - ths.forEach((th) => { - th.setAttribute('scope', 'col') - }) - } - } -} - -// ---- -// init -// ---- -TableBlock.init('.wp-block-table') - -// ---- -// export -// ---- -export default TableBlock diff --git a/src/js/index.js b/src/js/index.js index c2f085ac..b2cfa361 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -3,5 +3,3 @@ import './classes/ScrollDirection' import './classes/ButtonSeoClick' import './classes/Header' import './classes/Animation' -import './classes/ImageBlock' -import './classes/TableBlock'