chore(Table): Add aria-label to Table page size selector (#29391)

This commit is contained in:
Geido 2024-06-28 16:19:58 +02:00 committed by GitHub
parent 2a587a771c
commit 66bc8ceddd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -48,8 +48,13 @@ function DefaultSelectRenderer({
const [size, text] = Array.isArray(option) const [size, text] = Array.isArray(option)
? option ? option
: [option, option]; : [option, option];
const sizeLabel = size === 0 ? t('all') : size;
return ( return (
<option key={size} value={size}> <option
aria-label={t('Show %s entries', sizeLabel)}
key={size}
value={size}
>
{text} {text}
</option> </option>
); );

View File

@ -181,10 +181,10 @@ function SearchInput({ count, value, onChange }: SearchInputProps) {
<span className="dt-global-filter"> <span className="dt-global-filter">
{t('Search')}{' '} {t('Search')}{' '}
<input <input
aria-label={t('Search %s records', count)}
className="form-control input-sm" className="form-control input-sm"
placeholder={tn('search.num_records', count)} placeholder={tn('search.num_records', count)}
value={value} value={value}
aria-label={t('Search %s records', count)}
onChange={onChange} onChange={onChange}
/> />
</span> </span>
@ -211,8 +211,13 @@ function SelectPageSize({
const [size, text] = Array.isArray(option) const [size, text] = Array.isArray(option)
? option ? option
: [option, option]; : [option, option];
const sizeLabel = size === 0 ? t('all') : size;
return ( return (
<option key={size} value={size}> <option
aria-label={t('Show %s entries', sizeLabel)}
key={size}
value={size}
>
{text} {text}
</option> </option>
); );