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

fix(InlineNotification): make statusIconDescription optional #5528

Merged

Conversation

asudoh
Copy link
Contributor

@asudoh asudoh commented Mar 4, 2020

Given statucIconDescription in <InlineNotification> and one in <ToastNotification> have a fallback value, they shouldn't have isRequired in their prop types. This change fixes that.

Fixes #5527.

Changelog

Changed

  • Make statusIconDescription prop optional.

Testing / Reviewing

Testing should make sure <InlineNotification> and <ToastNotification> are not broken

@asudoh asudoh requested review from emyarod and tw15egan March 4, 2020 07:29
@asudoh asudoh requested a review from a team as a code owner March 4, 2020 07:29
Given `statucIconDescription` in `<InlineNotification>` and one in
`<ToastNotification>` have a fallback value, they shouldn't have
`isRequired` in their prop types. This change fixes that.

Fixes carbon-design-system#5527.
@asudoh asudoh force-pushed the statusicondescription-optional branch from ef11fd8 to 4b2ce6e Compare March 4, 2020 07:30
@netlify
Copy link

netlify bot commented Mar 4, 2020

Deploy preview for carbon-elements ready!

Built with commit ef11fd8

https://deploy-preview-5528--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Mar 4, 2020

Deploy preview for carbon-components-react ready!

Built with commit ef11fd8

https://deploy-preview-5528--carbon-components-react.netlify.com

@netlify
Copy link

netlify bot commented Mar 4, 2020

Deploy preview for carbon-components-react ready!

Built with commit c957756

https://deploy-preview-5528--carbon-components-react.netlify.com

@netlify
Copy link

netlify bot commented Mar 4, 2020

Deploy preview for carbon-elements ready!

Built with commit c957756

https://deploy-preview-5528--carbon-elements.netlify.com

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

looks good to me

@joshblack
Copy link
Contributor

Would we prefer to not include the fallback value? It seems to not be adding much value and seemingly would read better if we had people specify a value. Also would understand if we wanted to improve the fallback value and make this change? Down either way.

@asudoh
Copy link
Contributor Author

asudoh commented Mar 4, 2020

@tw15egan Any thoughts on the fallback value? Thanks!

@tw15egan
Copy link
Collaborator

tw15egan commented Mar 5, 2020

We should be consistent with other SVG description props throughout our components, so if we do not normally require them / provide fallback values, then they should be removed

@asudoh
Copy link
Contributor Author

asudoh commented Mar 5, 2020

Good point @tw15egan, one question on this front. Though we have a fallback value, I think most application needs to provide statusIconDescription anyway for the sake of g11n. That said, would we consider this property effectively required/optional?

@tw15egan
Copy link
Collaborator

tw15egan commented Mar 6, 2020

If we're going to keep it required, then yeah we should remove the fallback since they will need to specify their own to satisfy g11n requirements. However, it seems like iconDescription has a defaultProp of 'closes notification'. So isn't that essentially doing the same thing?

This seems to be another example of prop inconsistency that should be a major focus for v11. If we are requiring a prop, should we provide fallbacks that get picked up in testing, or make the user handle these cases right away by having a console warning?

The initial prop was just added because it was initially just getting the same text as the close button.

So I guess there are two options:

  1. Remove the required, since it has a fallback even if it is not specified. It would expect teams to handle this case during g11n testing, otherwise, they get the default English string.

  2. Keep it required, but remove the fallback. This would immediately alert users that they need to handle g11n for this prop on their own but would be pretty noisy. If we go this route, I'd probably add it to the list of things we want to do for v11 around prop consistency in our components.

@asudoh
Copy link
Contributor Author

asudoh commented Mar 6, 2020

Good question, here's what I understand; The fallback value like one for iconDescription is for providing good default that allows quick demonstration, etc. But for real-world application, iconDescripiton should be provided as we discussed for the sake of g11n.

For React isRequired thing, IIUC it has to be removed as long as there is a default value. So if we still keep the default (fallback) value there we should remove isRequired. Another option is removing default value there and make them isRequired, but it's a breaking change (at least for iconDescription) as @tw15egan alluded to.

@asudoh
Copy link
Contributor Author

asudoh commented Mar 10, 2020

Talked offline with @tw15egan and removed .isRequired from iconDescription. Thanks @tw15egan!

Copy link
Collaborator

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

👍 ✅

@asudoh asudoh merged commit fde409c into carbon-design-system:master Mar 10, 2020
@asudoh asudoh deleted the statusicondescription-optional branch March 10, 2020 23:01
aledavila pushed a commit that referenced this pull request Mar 18, 2020
Given `statucIconDescription` in `<InlineNotification>` and one in
`<ToastNotification>` have a fallback value, they shouldn't have
`isRequired` in their prop types. This change fixes that.

Fixes #5527.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

statusIconDescription prop in React notification components should be optional
4 participants