Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use icon button label as the aria-label to improve accessibility. #1066

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

FloatingSponge
Copy link
Contributor

@FloatingSponge FloatingSponge commented Jun 18, 2024

To prevent an accessibility violation, mui and material-ui IconButtons should be given an aria-label for use with screen-readers. This uses the button label (which is not otherwise displayed) as the aria-label for screen-readers.
The Autocomplete widgets also need aria-labels, in this case I've used the fieldPlaceHolder from config.

…it as the aria-label to improve accessibility.
Copy link

codesandbox bot commented Jun 18, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

vercel bot commented Jun 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-awesome-query-builder-examples ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2024 2:39pm
react-awesome-query-builder-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2024 2:39pm
react-awesome-query-builder-sandbox-next ✅ Ready (Inspect) Visit Preview Jun 19, 2024 2:39pm

Copy link

codesandbox-ci bot commented Jun 18, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a7411ef:

Sandbox Source
@react-awesome-query-builder/examples Configuration
@react-awesome-query-builder/sandbox Configuration
@react-awesome-query-builder/sandbox-simple Configuration
@react-awesome-query-builder/sandbox-next Configuration

@FloatingSponge
Copy link
Contributor Author

FloatingSponge commented Jun 18, 2024

Converted to draft as I investigate a similar aria problem with the field autocomplete widgets.

Copy link

codecov bot commented Jun 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.07%. Comparing base (2310dd2) to head (a7411ef).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1066   +/-   ##
=======================================
  Coverage   82.07%   82.07%           
=======================================
  Files         211      211           
  Lines       10844    10846    +2     
  Branches     1316     1318    +2     
=======================================
+ Hits         8900     8902    +2     
  Misses       1341     1341           
  Partials      603      603           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ukrbublik
Copy link
Owner

Thanks for the PR!
Could you please revert changes to the lock file?

@FloatingSponge
Copy link
Contributor Author

FloatingSponge commented Jun 19, 2024 via email

@@ -73,6 +73,10 @@ export default (props) => {
minWidth: minWidth
};
const placeholder = !readonly ? aPlaceholder : "";

// For accessibility, always give the input field an aria-label
const ariaLabel = config.settings.fieldPlaceholder;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please change this to const ariaLabel = placeholder || config.settings.fieldPlaceholder ?

MaterialAutocomplete can be used to select field in LHS (then aPlaceholder is null and it's correct to use fieldPlaceholder) but also can be used in RHS (see "Autocomplete" field in the example app)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And same for MuiAutocomplete please

Note: Mui* are for v5, Material* are for obsolete v4.

@ukrbublik ukrbublik merged commit cad7107 into ukrbublik:master Jun 19, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants