Skip to content

Commit

Permalink
Add labels to data views "in-filters" (#56001)
Browse files Browse the repository at this point in the history
* Add labels to data views "in" filters

All user inputs should have an accessible name, ideally provided by a visible label. This patch ensures that data views "in" filters semantically associate the visible label with the select input, ensuring that the input has an accessible name.
  • Loading branch information
Andrew Hayward authored and cbravobernal committed Nov 14, 2023
1 parent 41b630d commit 80c7e00
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/edit-site/src/components/dataviews/in-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ export default ( { filter, view, onChangeView } ) => {
? ''
: valueFound.value;

const id = `dataviews__filters-in-${ filter.field }`;

return (
<SelectControl
id={ id }
value={ activeValue }
prefix={
<InputControlPrefixWrapper
as="span"
as="label"
htmlFor={ id }
className="dataviews__select-control-prefix"
>
{ filter.name + ':' }
Expand Down

0 comments on commit 80c7e00

Please sign in to comment.