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

fix: update Dropdown and MultiSelect to handle interactive labels #18643

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

adamalston
Copy link
Contributor

@adamalston adamalston commented Feb 20, 2025

Closes #16987

Updated Dropdown and MultiSelect to handle interactive labels.

Changelog

Changed

  • Updated Dropdown and MultiSelect to handle interactive labels.

Testing / Reviewing

yarn test packages/react/src/components/Dropdown packages/react/src/components/MultiSelect

I tried to write a test for these changes. I couldn't get it to pass. I think it has something to do with the changing visibility of the popover and its visibility from the test's perspective. Curious to hear if anyone has suggestions to test these changes. Alternatively, I created Storybook entries.

it('should not steal the focus from interactive elements in titleText', async () => {
  render(
    <Dropdown
      {...mockProps}
      titleText={
        <>
          <ToggletipLabel>Dropdown label</ToggletipLabel>
          <Toggletip>
            <ToggletipButton>Info</ToggletipButton>
            <ToggletipContent>Tooltip content</ToggletipContent>
          </Toggletip>
        </>
      }
    />
  );
  await waitForPosition();

  // Initially, the toggletip content should not be visible
  expect(screen.queryByTestId('toggletip-content')).not.toBeVisible();

  // Click the toggletip button
  await userEvent.click(screen.getByTestId('toggletip-button'));

  // Wait for any asynchronous updates (if needed)
  await waitFor(() => {
    expect(screen.getByTestId('toggletip-content')).toBeVisible();
  });
});

Copy link

netlify bot commented Feb 20, 2025

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

Name Link
🔨 Latest commit 456014d
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/67bf393f28c19000089a9f35
😎 Deploy Preview https://deploy-preview-18643--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 20, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 456014d
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/67bf393fddeb820008d354de
😎 Deploy Preview https://deploy-preview-18643--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 20, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 456014d
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/67bf393fc3c1bc000877aa07
😎 Deploy Preview https://deploy-preview-18643--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 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.97%. Comparing base (84fd364) to head (e82f778).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18643   +/-   ##
=======================================
  Coverage   84.97%   84.97%           
=======================================
  Files         408      408           
  Lines       14543    14545    +2     
  Branches     4765     4771    +6     
=======================================
+ Hits        12358    12360    +2     
  Misses       2023     2023           
  Partials      162      162           

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

@adamalston adamalston force-pushed the 16987-title-text branch 2 times, most recently from ecb134d to 106c5f5 Compare February 22, 2025 16:47
@adamalston adamalston marked this pull request as ready for review February 22, 2025 17:45
@adamalston adamalston requested review from a team as code owners February 22, 2025 17:45
Copy link
Member

@annawen1 annawen1 left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

[Bug]: Interactive elements inside of Dropdown's titleText prop do not work correctly
3 participants