fix: make ActionableNotification subtitle proptypes node to allow objects#13821
fix: make ActionableNotification subtitle proptypes node to allow objects#13821kodiakhq[bot] merged 9 commits into
subtitle proptypes node to allow objects#13821Conversation
✅ Deploy Preview for carbon-components-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for carbon-components-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
…rhuff-ibm/carbon into notification-subtitle-proptype
tay1orjones
left a comment
There was a problem hiding this comment.
I think this change should probably only be made to ActionableNotification.
InlineNotification and ToastNotification can only have a role of alert, status, or log, which means:
- All semantic value (rich text, line breaks, etc) placed in the
subtitlewould not be read by screenreaders. - These components can't contain interactive elements like hyperlinks
For those reasons I think it makes the most sense to keep subtitle as a plain string in InlineNotification and ToastNotification.
Opening up subtitle to be a node in ActionableNotification should be fine though because it gets a role of alertdialog, which preserves semantic value and can include interactive elements.
|
Our use case for adding |
There was a problem hiding this comment.
@crhuff-ibm Sorry for the delayed response here. If you're using any rich text decoration you'll need to use ActionableNotification.
I've updated the PR so that ActionableNotification's actionButtonLabel is now optional and the button isn't rendered if the actionButtonLabel isn't provided. This makes it so you can configure just subtitle without an action.
With this PR, your usage would look something like this:
export default function App() {
const subtitle = (
<span>
I've got some <strong>rich</strong> <em>text</em>{' '}
<strong>
<em>here</em>
</strong>
</span>
);
return (
<div>
<ActionableNotification inline subtitle={subtitle} />
</div>
);
}subtitle proptypes node to allow objects
tw15egan
left a comment
There was a problem hiding this comment.
Ideal tradeoff 👍🏻
LGTM 👍 ✅
|
Deal, thank you for the compromise! |
Make actionable notification subtitle proptypes to allow more than just a string. If the consumer wants things like bold text, hyperlinks, multiple lines for text, a string doesn't allow it without throwing warnings.
Changelog
Changed
Testing / Reviewing
Test
Inline orActionable Notification withsubtitle={<div>text</div>}instead ofsubtitle="text"and view no warnings.