Skip to content

Commit

Permalink
Remove label from dataview checkbox (#67868)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: afercia <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: alexstine <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
  • Loading branch information
6 people authored Jan 3, 2025
1 parent 3fc25a1 commit 89de183
Showing 1 changed file with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { CheckboxControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -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 (
<CheckboxControl
className="dataviews-selection-checkbox"
Expand Down

0 comments on commit 89de183

Please sign in to comment.