-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(Dropdown): render selected item rich content #5578
feat(Dropdown): render selected item rich content #5578
Conversation
Deploy preview for carbon-components-react ready! Built with commit d372d76 https://deploy-preview-5578--carbon-components-react.netlify.com |
Deploy preview for carbon-elements ready! Built with commit d372d76 |
The link for the option number needs to be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 - Thanks @emyarod! Just one thing in case if you want to do; Would it worth using the new inner-component for each items in the dropdown, too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@asudoh do you have any suggestion on what to replace it with for the demo? |
49ce876
to
0e93d5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
9bb6298
to
115cbe6
Compare
b4fa99f
to
9411e54
Compare
I think this change is warranted as we are finding that users are hacking |
@emyarod would we want to support arbitrary rendering in the field, though? It seems like a situation where we would want to constrain markup to only a string in order to stay consistent with visual guidelines along with making sure accessibility is not a concern (in the case of rendering an interactive widget in the field position) |
@joshblack yes I believe so, given that design has expressed that this should be the expected behavior (dropdown option appears the same when it is the selected item) and that users are currently hacking |
a5439c2
to
d52afaf
Compare
Storybook issue should be resolved now. It seems that the concern is about what our users could potentially come up with. Since we already allow rich content in the options menu we can at least provide the option to render the selected item unchanged as an escape hatch, especially after seeing previous requests for this and how users are currently hacking around component limitations to implement this. I don't see the benefit to attempting to limit this when users are already implementing this behavior (in a broken fashion) with the current component API |
d52afaf
to
c5d5e35
Compare
The idea here is that there seems to be no defining use-case for this functionality and that providing it could make it easier to build inaccessible or inconsistent experiences. Some of the cases that popped up here that we wouldn't want to enable:
In addition, reusing the API for both option and field could be considered a bug for people who may only want to render the rich content in one place but not the other (even if doing so would provide an inconsistent or inaccessible experience) Similarly, we should not use a link in our example regardless because it seems to fail AVT2. This type of situation is what we want to avoid. If folks want to hack around stuff to do this, they are well within their rights to do so. It doesn't mean that we make this a common or happy path when it doesn't align with a use-case of this component or the experience that we want folks to leverage while shipping product functionality. |
Closing based on above and resolution from support channel 👍 Feel free to reach out if this should be re-opened! |
This PR matches rich content in the selected item to match its appearance in the dropdown options list
Fixes #5576.
Fixes #5698.
Testing / Reviewing
Ensure the selected item appears and behaves the same as it does in the dropdown options list