From 7944116be41c3758efe6a6f55874d621f97df155 Mon Sep 17 00:00:00 2001 From: Brian Hanson Date: Fri, 16 Feb 2024 11:10:59 -0600 Subject: [PATCH 1/3] =?UTF-8?q?Add=20abillity=20to=20customize=20a=20badge?= =?UTF-8?q?=E2=80=99s=20label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sources can now have a `badgeLabel` property which will be used for screen readers when rendering the source’s badge. --- src/templates/_elements/sources.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/_elements/sources.twig b/src/templates/_elements/sources.twig index b82bbddbf01..89566e23176 100644 --- a/src/templates/_elements/sources.twig +++ b/src/templates/_elements/sources.twig @@ -79,7 +79,7 @@ data: { notification: true, }, - text: '{num, number} {num, plural, =1{notification} other{notifications}}'|t('app', { + text: source.badgeLabel ?? '{num, number} {num, plural, =1{notification} other{notifications}}'|t('app', { num: source.badgeCount, }), }) }} From 55ae8d684713c6500529ac3ffa016309fcb388ae Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Sat, 17 Feb 2024 07:25:52 -0800 Subject: [PATCH 2/3] Document it --- src/base/ElementInterface.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/base/ElementInterface.php b/src/base/ElementInterface.php index 5837c09c6fb..19c840613a3 100644 --- a/src/base/ElementInterface.php +++ b/src/base/ElementInterface.php @@ -269,6 +269,7 @@ public static function createCondition(): ElementConditionInterface; * - **`status`** – The status color that should be shown beside the source label. Possible values include `green`, * `orange`, `red`, `yellow`, `pink`, `purple`, `blue`, `turquoise`, `light`, `grey`, `black`, and `white`. (Optional) * - **`badgeCount`** – The badge count that should be displayed alongside the label. (Optional) + * - **`badgeLabel`** – The badge count label that should be provided for screen readers. (Optional) * - **`sites`** – An array of site IDs or UUIDs that the source should be shown for, on multi-site element indexes. * (Optional; by default the source will be shown for all sites.) * - **`criteria`** – An array of element criteria parameters that the source should use when the source is selected. From b1d0c289a1eddb3190cedcd2a717e7f2d74626b3 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Sat, 17 Feb 2024 07:26:02 -0800 Subject: [PATCH 3/3] Release note [ci skip] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f71dc1ad648..1566cddcac2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Slideout sidebars are now always toggleable; not just when the slideout is too narrow to show the sidebar alongside the content. ([#14418](https://github.com/craftcms/cms/pull/14418)) - Field Layout Designers now hide the component library sidebar in favor of “Add” disclosure menus, when they’re too narrow to show the sidebar alongside configured tabs. ([#14411](https://github.com/craftcms/cms/pull/14411)) +- Element sources can now override the default badge count label for screen readers, via a `badgeLabel` key. ([#14410](https://github.com/craftcms/cms/pull/14410)) - Fixed a bug where it wasn’t possible to clear out users’ full names once they were set. ([#14402](https://github.com/craftcms/cms/pull/14402)) - Fixed an error that occurred when attempting to add nested elements to Addresses or Matrix fields on element types that don’t support drafts. ([#14396](https://github.com/craftcms/cms/pull/14396)) - Fixed a bug where double-digit nav item badge counts were overflowing. ([#14406](https://github.com/craftcms/cms/issues/14406))