Skip to content

fix(copybutton): react and wc parity #18318

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

Merged
merged 9 commits into from
Feb 11, 2025

Conversation

anamikaanu96
Copy link
Contributor

Closes #17928

Copy button - react and wc parity

Changelog

Changed

  • packages/web-components/src/components/copy-button/copy-button.stories.ts
  • packages/web-components/src/components/copy-button/copy-button.ts
  • packages/web-components/src/components/copy/copy.ts

Testing / Reviewing

Found that three props (align, autoAlign, and as) were missing and added the align and autoAlign props.
As per the discussion I haven't included as prop.

Tested using storybook , can be checked in storybook controls.

@anamikaanu96 anamikaanu96 requested a review from a team as a code owner January 9, 2025 10:40
Copy link

netlify bot commented Jan 9, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit 619df1b
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/67a45d49d3c2f700082ee13c
😎 Deploy Preview https://deploy-preview-18318--v11-carbon-web-components.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.

Copy link

netlify bot commented Jan 9, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 619df1b
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/67a45d499c01f20008e6f1ff
😎 Deploy Preview https://deploy-preview-18318--carbon-elements.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.

Copy link

netlify bot commented Jan 9, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 619df1b
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/67a45d4936ea530008399c35
😎 Deploy Preview https://deploy-preview-18318--v11-carbon-react.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.

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.10%. Comparing base (c0e4c95) to head (619df1b).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18318      +/-   ##
==========================================
- Coverage   84.13%   84.10%   -0.04%     
==========================================
  Files         408      408              
  Lines       14460    14466       +6     
  Branches     4673     4676       +3     
==========================================
  Hits        12166    12166              
- Misses       2128     2133       +5     
- Partials      166      167       +1     

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

@tay1orjones tay1orjones requested review from a team and ecarriechung and removed request for a team January 14, 2025 14:25
@laurenmrice laurenmrice self-requested a review January 15, 2025 15:40
@tay1orjones
Copy link
Member

Hey, thanks for putting up this PR! Thanks @laurenmrice for assigning yourself as a reviewer to be sure we get a ux and visual review on this.

@laurenmrice laurenmrice removed the request for review from ecarriechung January 21, 2025 19:13
Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

Hey @anamikaanu96, just had a couple questions below, otherwise this PR looks good to me.

  1. There is an onClick prop in React but not in the Playground story of Web components. Is that intentional?

  2. Also a prop naming convention inconsistency I wanted to clarify: It is called ”autoAlign” in React and it is called “autoalign” in Web components. Just wanted to make sure the lowercase a in "align" was intentional and if it matters or not. My thoughts were thinking we should keep it exactly the same as React when possible?

  3. We should remove the Playground story and add the controls to the Default story, to match React storybook.


Note: I am opening a separate bug issue about the tooltip properties and an existing potential Safari browser bug, which is not related to this PR.

@anamikaanu96
Copy link
Contributor Author

Hey @anamikaanu96, just had a couple questions below, otherwise this PR looks good to me.

  1. There is an onClick prop in React but not in the Playground story of Web components. Is that intentional?
  2. Also a prop naming convention inconsistency I wanted to clarify: It is called ”autoAlign” in React and it is called “autoalign” in Web components. Just wanted to make sure the lowercase a in "align" was intentional and if it matters or not. My thoughts were thinking we should keep it exactly the same as React when possible?
  3. We should remove the Playground story and add the controls to the Default story, to match React storybook.

Note: I am opening a separate bug issue about the tooltip properties and an existing potential Safari browser bug, which is not related to this PR.

Hey @laurenmrice Thanks for reviewing! I have done the changes you have mentioned in point 2 and 3.
Regarding the onClick prop, its intentional to not add this in storybook controls since its natively supported in web components. I confirmed it with @ariellalgilmore.

Copy link
Member

@laurenmrice laurenmrice 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!

Copy link
Member

@kennylam kennylam left a comment

Choose a reason for hiding this comment

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

@anamikaanu96 Thanks for this! The styles are off with -start and -end alignments:

bottom-end
image

top-start
image

left-end
image

@laurenmrice
Copy link
Member

laurenmrice commented Feb 4, 2025

@kennylam I had made a separate issue for this because I think it also might be a current bug in React. #18445. But if you want to tackle it here we can!

@kennylam
Copy link
Member

kennylam commented Feb 4, 2025

I had made a separate issue for this because it also seems to be happening in React

Ah, got it, thanks! No I think you're right, better to deal with separately.

@anamikaanu96 anamikaanu96 requested a review from kennylam February 6, 2025 06:58
Copy link
Member

@kennylam kennylam left a comment

Choose a reason for hiding this comment

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

LGTM!

@kennylam kennylam added this pull request to the merge queue Feb 11, 2025
Merged via the queue into carbon-design-system:main with commit d100cac Feb 11, 2025
37 checks passed
@carbon-automation
Copy link
Contributor

Hey there! v11.76.0 was just released that references this issue/PR.

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.

React|WC Parity: Copy-button
5 participants