Skip to content

Commit ba79c50

Browse files
karthick-murugankarthick-muruganaferciat-hamanoalexstine
authored andcommitted
Remove label from dataview checkbox (WordPress#67868)
* Image size fix in lightbox * Revert "Image size fix in lightbox" This reverts commit 63f81c1. * Remove label from dataview checkbox * Feedback changes * Feedback Changes Co-authored-by: karthick-murugan <karthickmurugan@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: alexstine <alexstine@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
1 parent 43df072 commit ba79c50

File tree

1 file changed

+6
-15
lines changed
  • packages/dataviews/src/components/dataviews-selection-checkbox

1 file changed

+6
-15
lines changed

packages/dataviews/src/components/dataviews-selection-checkbox/index.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* WordPress dependencies
33
*/
4-
import { __, sprintf } from '@wordpress/i18n';
54
import { CheckboxControl } from '@wordpress/components';
5+
import { __ } from '@wordpress/i18n';
66

77
/**
88
* Internal dependencies
@@ -29,20 +29,11 @@ export default function DataViewsSelectionCheckbox< Item >( {
2929
}: DataViewsSelectionCheckboxProps< Item > ) {
3030
const id = getItemId( item );
3131
const checked = ! disabled && selection.includes( id );
32-
let selectionLabel;
33-
if ( titleField?.getValue && item ) {
34-
// eslint-disable-next-line @wordpress/valid-sprintf
35-
selectionLabel = sprintf(
36-
checked
37-
? /* translators: %s: item title. */ __( 'Deselect item: %s' )
38-
: /* translators: %s: item title. */ __( 'Select item: %s' ),
39-
titleField.getValue( { item } )
40-
);
41-
} else {
42-
selectionLabel = checked
43-
? __( 'Select a new item' )
44-
: __( 'Deselect item' );
45-
}
32+
33+
// Fallback label to ensure accessibility
34+
const selectionLabel =
35+
titleField?.getValue?.( { item } ) || __( '(no title)' );
36+
4637
return (
4738
<CheckboxControl
4839
className="dataviews-selection-checkbox"

0 commit comments

Comments
 (0)