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

refactor(FloatingMenu): rewrite in typescript #18722

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamalston
Copy link
Contributor

Closes #18720

Rewrote FloatingMenu in TypeScript.

Changelog

Changed

  • Rewrote FloatingMenu in TypeScript.
  • Updated types in the wrapFocus util and OverflowMenu component.

Testing / Reviewing

yarn test packages/react/src/components/OverflowMenu

I left a TODO in the code. Curious to hear others' thoughts.

I didn't see a reason to memoize handleMenuRef or put it in a useCallback. If someone finds one, this code should work.

const handleMenuRef = useCallback(
  (node: HTMLElement | null) => {
    if (node === menuBodyRef.current) return;

    menuBodyRef.current = node;
    placeInProgressRef.current = !!node;

    if (externalMenuRef) {
      externalMenuRef(node);
    }

    if (node) {
      updateMenuPosition();
    }
  },
  [externalMenuRef, updateMenuPosition]
);

Copy link

netlify bot commented Feb 27, 2025

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

Name Link
🔨 Latest commit a68f388
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/67c0877c4f3339000856d1b0
😎 Deploy Preview https://deploy-preview-18722--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 Feb 27, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit a68f388
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/67c0877c7ab2920008fe2137
😎 Deploy Preview https://deploy-preview-18722--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 Feb 27, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a68f388
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/67c0877c84d2eb00089e230e
😎 Deploy Preview https://deploy-preview-18722--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 Feb 27, 2025

Codecov Report

Attention: Patch coverage is 50.38168% with 65 lines in your changes missing coverage. Please review.

Project coverage is 84.30%. Comparing base (1d57a3a) to head (a68f388).

Files with missing lines Patch % Lines
packages/react/src/internal/FloatingMenu.tsx 49.60% 63 Missing and 1 partial ⚠️
...react/src/components/OverflowMenu/OverflowMenu.tsx 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18722      +/-   ##
==========================================
- Coverage   84.34%   84.30%   -0.05%     
==========================================
  Files         408      408              
  Lines       14645    14637       -8     
  Branches     4791     4820      +29     
==========================================
- Hits        12352    12339      -13     
- Misses       2131     2145      +14     
+ Partials      162      153       -9     

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

@adamalston adamalston marked this pull request as ready for review February 27, 2025 16:13
@adamalston adamalston requested review from a team as code owners February 27, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewrite FloatingMenu in TypeScript
1 participant