From 89de1839e858c9233380769b9e57025d7bc6c4ba Mon Sep 17 00:00:00 2001 From: Karthick M <97787966+karthick-murugan@users.noreply.github.com> Date: Fri, 3 Jan 2025 16:17:09 +0530 Subject: [PATCH] Remove label from dataview checkbox (#67868) * Image size fix in lightbox * Revert "Image size fix in lightbox" This reverts commit 63f81c1e9cbb3b0513abca2b8cb579fef374ed7b. * Remove label from dataview checkbox * Feedback changes * Feedback Changes Co-authored-by: karthick-murugan Co-authored-by: afercia Co-authored-by: t-hamano Co-authored-by: alexstine Co-authored-by: ntsekouras --- .../dataviews-selection-checkbox/index.tsx | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/packages/dataviews/src/components/dataviews-selection-checkbox/index.tsx b/packages/dataviews/src/components/dataviews-selection-checkbox/index.tsx index 827f061976443..e069e7d74b0ef 100644 --- a/packages/dataviews/src/components/dataviews-selection-checkbox/index.tsx +++ b/packages/dataviews/src/components/dataviews-selection-checkbox/index.tsx @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { __, sprintf } from '@wordpress/i18n'; import { CheckboxControl } from '@wordpress/components'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies @@ -29,20 +29,11 @@ export default function DataViewsSelectionCheckbox< Item >( { }: DataViewsSelectionCheckboxProps< Item > ) { const id = getItemId( item ); const checked = ! disabled && selection.includes( id ); - let selectionLabel; - if ( titleField?.getValue && item ) { - // eslint-disable-next-line @wordpress/valid-sprintf - selectionLabel = sprintf( - checked - ? /* translators: %s: item title. */ __( 'Deselect item: %s' ) - : /* translators: %s: item title. */ __( 'Select item: %s' ), - titleField.getValue( { item } ) - ); - } else { - selectionLabel = checked - ? __( 'Select a new item' ) - : __( 'Deselect item' ); - } + + // Fallback label to ensure accessibility + const selectionLabel = + titleField?.getValue?.( { item } ) || __( '(no title)' ); + return (