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

[OLD] feat: Chip component redesign #2713

Closed

Conversation

PKulkoRaccoonGang
Copy link
Contributor

@PKulkoRaccoonGang PKulkoRaccoonGang commented Oct 11, 2023

Description

  • Chip component redesign.

Issue: #2645

Deploy Preview

Chip component

Merge Checklist

  • If your update includes visual changes, have they been reviewed by a designer? Send them a link to the Netlify deploy preview, if applicable.
  • Does your change adhere to the documented style conventions?
  • Do any prop types have missing descriptions in the Props API tables in the documentation site (check deploy preview)?
  • Were your changes tested using all available themes (see theme switcher in the header of the deploy preview, under the "Settings" icon)?
  • Were your changes tested in the example app?
  • Is there adequate test coverage for your changes?
  • Consider whether this change needs to reviewed/QA'ed for accessibility (a11y). If so, please add wittjeff and adamstankiewicz as reviewers on this PR.

Post-merge Checklist

  • Verify your changes were released to NPM at the expected version.
  • If you'd like, share your contribution in #show-and-tell.
  • 🎉 🙌 Celebrate! Thanks for your contribution.

@netlify
Copy link

netlify bot commented Oct 11, 2023

Deploy Preview for paragon-openedx ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 8fa7b1a
🔍 Latest deploy log https://app.netlify.com/sites/paragon-openedx/deploys/654ce1c9509d9000084cc0de
😎 Deploy Preview https://deploy-preview-2713--paragon-openedx.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@openedx-webhooks openedx-webhooks added the blended PR is managed through 2U's blended developmnt program label Oct 11, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Oct 11, 2023

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:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

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.

@PKulkoRaccoonGang PKulkoRaccoonGang marked this pull request as draft October 11, 2023 16:27
@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/chip-redesign branch from a79c5b5 to acad78f Compare October 16, 2023 12:01
@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (00c48ec) 92.83% compared to head (8fa7b1a) 92.87%.
Report is 4 commits behind head on master.

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              
Files Coverage Δ
src/Chip/ChipIcon.tsx 100.00% <100.00%> (ø)
src/Chip/constants.js 100.00% <100.00%> (ø)
src/Chip/index.tsx 100.00% <100.00%> (ø)
src/utils/propTypes/utils.js 94.11% <100.00%> (+3.20%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/chip-redesign branch from efa81af to 9fa3921 Compare October 16, 2023 12:32
@PKulkoRaccoonGang PKulkoRaccoonGang marked this pull request as ready for review October 16, 2023 12:35
src/Chip/mixins.scss Outdated Show resolved Hide resolved
src/Chip/index.tsx Outdated Show resolved Hide resolved
src/Chip/index.scss Outdated Show resolved Hide resolved
src/Chip/index.tsx Outdated Show resolved Hide resolved
@monteri
Copy link
Contributor

monteri commented Oct 17, 2023

There is one issue: for the disabled Chip you can highlight the text.

@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/chip-redesign branch 2 times, most recently from e9a9520 to 2142773 Compare October 17, 2023 13:43
@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/chip-redesign branch from 68e4598 to bf80855 Compare October 18, 2023 13:23
src/Chip/README.md Outdated Show resolved Hide resolved
src/Chip/index.tsx Outdated Show resolved Hide resolved
src/Chip/index.tsx Outdated Show resolved Hide resolved
src/SelectableBox/tests/SelectableBoxSet.test.jsx Outdated Show resolved Hide resolved
src/Chip/Chip.test.jsx Outdated Show resolved Hide resolved
src/Chip/Chip.test.jsx Outdated Show resolved Hide resolved
@viktorrusakov viktorrusakov linked an issue Oct 19, 2023 that may be closed by this pull request
Copy link
Member

@adamstankiewicz adamstankiewicz left a comment

Choose a reason for hiding this comment

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

This is looking great! Left a couple comments/suggestions.

);
}

return <Icon src={src} className={className} />;
Copy link
Member

Choose a reason for hiding this comment

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

[curious] I'm wondering if we should be using the size="sm" attribute for the Chip icons so it more closely matches the small font size used inside the Chip?

image

src/Chip/ChipIcon.tsx Show resolved Hide resolved
Comment on lines 42 to 43
tabIndex={0}
role="button"
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

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 */
Copy link
Member

Choose a reason for hiding this comment

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

nit: is this eslint disable line still relevant?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not after rebasing on master, thanks 🙂

@viktorrusakov viktorrusakov force-pushed the Peter_Kulko/chip-redesign branch from 0bd7c0f to b50147b Compare October 27, 2023 11:17
refactor: added selected state

refactor: added IconButton

refactor: styles refactoring

refactor: added tests

refactor: added new SCSS variables
@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/chip-redesign branch from 0fe30c0 to d6becf4 Compare November 6, 2023 12:35
Copy link
Member

@adamstankiewicz adamstankiewicz left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines 45 to 46
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.
Copy link
Member

Choose a reason for hiding this comment

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

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).

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@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?

Copy link
Member

@adamstankiewicz adamstankiewicz Nov 6, 2023

Choose a reason for hiding this comment

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

@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']),
};

Copy link
Contributor

Choose a reason for hiding this comment

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

@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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, corrected

src/Chip/README.md Outdated Show resolved Hide resolved
src/Chip/README.md Outdated Show resolved Hide resolved
@PKulkoRaccoonGang PKulkoRaccoonGang marked this pull request as draft November 9, 2023 11:38
@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/chip-redesign branch from da74e3d to 8fa7b1a Compare November 9, 2023 13:42
@PKulkoRaccoonGang PKulkoRaccoonGang marked this pull request as ready for review November 9, 2023 13:42
@PKulkoRaccoonGang PKulkoRaccoonGang changed the title [BD-46] feat: Chip component redesign [OLD] feat: Chip component redesign Nov 21, 2023
@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U and removed blended PR is managed through 2U's blended developmnt program labels Nov 21, 2023
@openedx-webhooks
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.

Chip implementation updates
5 participants