From bcd2c1e1c3f832d2d16bfbe4eb4e341eaeffdccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Andrietti?= Date: Mon, 16 Jun 2025 13:20:10 +0200 Subject: [PATCH 1/2] fix a11y breadcrumb --- inc/Framework.php | 2 + inc/Services/Breadcrumb.php | 76 +++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 inc/Services/Breadcrumb.php diff --git a/inc/Framework.php b/inc/Framework.php index c435cd17..ce7a9044 100644 --- a/inc/Framework.php +++ b/inc/Framework.php @@ -4,6 +4,7 @@ use BEA\Theme\Framework\Services\Acf; use BEA\Theme\Framework\Services\Assets; +use BEA\Theme\Framework\Services\Breadcrumb; use BEA\Theme\Framework\Services\Performance; use BEA\Theme\Framework\Services\Editor; use BEA\Theme\Framework\Services\Editor_Patterns; @@ -39,6 +40,7 @@ class Framework { Svg::class, Acf::class, Menu::class, + Breadcrumb::class, // Services as Tools Body_Class::class, diff --git a/inc/Services/Breadcrumb.php b/inc/Services/Breadcrumb.php new file mode 100644 index 00000000..bf8cb4c6 --- /dev/null +++ b/inc/Services/Breadcrumb.php @@ -0,0 +1,76 @@ +', '', $link_output ); + } + + return $link_output; + } + + /** + * Remove the breadcrumbs separator outside the links. + * + * @return string + */ + public function remove_breadcrumb_separator(): string { + return ''; + } +} From 2c7c82c649b15e1bd121c5ffb65209eb7d8ceb68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Andrietti?= Date: Mon, 16 Jun 2025 13:25:04 +0200 Subject: [PATCH 2/2] fix a11y breadcrumb add class to separator --- inc/Services/Breadcrumb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/Services/Breadcrumb.php b/inc/Services/Breadcrumb.php index bf8cb4c6..1ddf76d0 100644 --- a/inc/Services/Breadcrumb.php +++ b/inc/Services/Breadcrumb.php @@ -59,7 +59,7 @@ public function replace_breadcrumb_link_wrapper(): string { */ public function replace_breadcrumb_link( $link_output ): string { if ( ! str_contains( $link_output, 'breadcrumb_last' ) ) { - return str_replace( '', '', $link_output ); + return str_replace( '', '', $link_output ); } return $link_output;