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

Do not provide accessible labels by default, for example: "Provide icon description" #9466

Closed
5 tasks
Tracked by #9356
joshblack opened this issue Aug 11, 2021 · 2 comments · Fixed by #9731 or #9741
Closed
5 tasks
Tracked by #9356

Comments

@joshblack
Copy link
Contributor

joshblack commented Aug 11, 2021

There are several situations where we use defaultProps to provide a placeholder accessible label. In v11, these props should be treated as required with no default props.

function TestComponent() {
  // ...
}

// From
TestComponent.propTypes = {
  iconDescription: PropTypes.string,
};

TestComponent.defaultProps = {
  iconDescription: 'Provide a description',
};

// To
TestComponent.propTypes = {
  iconDescription: PropTypes.string.isRequired,
};

TestComponent.defaultProps = {
};

This may be tricky to get right with feature flags and most likely will require using the top-level feature flag package instead of being able to use a hook 😞

Below is a list of components that currently do this:

  • FileUploader
  • SelectItemGroup
  • NumberInput
  • Switch
  • OverflowMenuItem

Note: there may have been some that have been missed, this was a quick search!

@joshblack joshblack changed the title Do not provide accessible labels by default, for example: "Provide icon description" @tw15egan Do not provide accessible labels by default, for example: "Provide icon description" Aug 11, 2021
@tw15egan
Copy link
Collaborator

@joshblack do you have examples of how to use this with class-based components? Might this be easier to just switch to .isRequired on the next branch as we get close to release?

@abbeyhrt
Copy link
Contributor

@joshblack Is it fair to assume that we only want to update the non-obvious ones? Like a 'Close' icon with a default iconDescription of 'close' or say CopyButton having a "Copy to clipboard" for the copy icon would be sensible defaults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants