Repository navigation
[OLD] feat: Chip component redesign - #2713
peterkulko wants to merge 10 commits into
Conversation
✅ Deploy Preview for paragon-openedx ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
Thanks for the pull request, @PKulkoRaccoonGang! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
a79c5b5 to
acad78f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2713 +/- ##
==========================================
+ Coverage 92.83% 92.87% +0.04%
==========================================
Files 235 237 +2
Lines 4240 4265 +25
Branches 1029 1036 +7
==========================================
+ Hits 3936 3961 +25
Misses 300 300
Partials 4 4
☔ View full report in Codecov by Sentry. |
efa81af to
9fa3921
Compare
|
There is one issue: for the disabled Chip you can highlight the text. |
e9a9520 to
2142773
Compare
68e4598 to
bf80855
Compare
adamstankiewicz
left a comment
There was a problem hiding this comment.
This is looking great! Left a couple comments/suggestions.
| ); | ||
| } | ||
|
|
||
| return <Icon src={src} className={className} />; |
| tabIndex={0} | ||
| role="button" |
There was a problem hiding this comment.
If the left/right icons included in the Chip are interactive, I believe the intent is to not have the top-level Chip be interactive as a button, where only the icon(s) are interactive. This prevents possible usability issues where user is trying to dismiss the Chip but accidentally clicks on the parent Chip container instead of the IconButton.
Similarly, if the icon(s) are interactive, the parent Chip should remain unchanged from a hover styles perspective. The only hover focus in this case should be on the IconButton itself.
There was a problem hiding this comment.
Great points! I've refactored some stuff here and updated docs and I believe I achieved the behaviour you described, so please take a look again and let me know what you think 🙂
| @@ -1,3 +1,4 @@ | |||
| /* eslint-disable no-console */ | |||
There was a problem hiding this comment.
nit: is this eslint disable line still relevant?
There was a problem hiding this comment.
Not after rebasing on master, thanks 🙂
0bd7c0f to
b50147b
Compare
refactor: added selected state refactor: added IconButton refactor: styles refactoring refactor: added tests refactor: added new SCSS variables
0fe30c0 to
d6becf4
Compare
adamstankiewicz
left a comment
There was a problem hiding this comment.
This is looking great; I added one suggestion related to alt text props and a couple minor nits. Even though none of the existing Chip props seem to have changed, I'm thinking this may technically need to be released as a breaking change due to the change in some of the SCSS theme variables that theme authors may have been relying on.
Given this Chip breaking change and the other breaking change we're considering (Pagination), perhaps we consider creating a single major version release that contains the breaking changes of both components to avoid back-to-back major version releases.
| Use `iconBefore` and `iconAfter` props to provide icons for the `Chip`, note that you also have to provide | ||
| accessible names for these icons for screen reader support via `iconBeforeAlt` and `iconAfterAlt` respectively. |
There was a problem hiding this comment.
I believe the associated alt accessible name should only be required when the icon itself is clickable. If an icon is not interactive, it may mean the icon is purely decorative and may not have any semantic meaning for screen reader users. As opposed to an interactive icon (e.g., "X" to dismiss the Chip), which consumers would need to provide an alt to describe the intent of the interactive icon to screen readers.
For example, the following Chip with a person icon; the Chip contents describe the user where the icon itself could be considered decorative vs. semantic (i.e., the icon itself isn't what's describing the contents of the Chip).
There was a problem hiding this comment.
@adamstankiewicz Do we need to remove the prop to add alt text for an icon that is not clickable? Or will we just edit the supporting text on the documentation site and leave this option?
There was a problem hiding this comment.
@PKulkoRaccoonGang As is, I believe the alt text for the icons is always required whenever an icon is passed. I would recommend modifying the conditionally required alt text based not only on whenever an icon is passed, but also if its associated click handler is passed as well. E.g., perhaps something along the lines of:
Chip.propTypes = {
iconBeforeAlt: requiredWhen(PropTypes.string, ['iconBefore', 'onIconBeforeClick']),
};There was a problem hiding this comment.
@PKulkoRaccoonGang I think requiredWhen accepts only strings as a second argument and it does not know how to work with lists, so right now this prop validation does not work, can you please check this? (and modify requiredWhen if necessary)
Also, we probably need to change have to to can in the description of this example, because it's not always required to pass alt text anymore.
There was a problem hiding this comment.
Thanks, corrected
da74e3d to
8fa7b1a
Compare
|
@PKulkoRaccoonGang Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |

Description
Issue: #2645
Deploy Preview
Chip component
Merge Checklist
exampleapp?wittjeffandadamstankiewiczas reviewers on this PR.Post-merge Checklist