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: Select component on hover shows invalid title/tooltip 15752 #18740

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

Conversation

Bhas-kar
Copy link

@Bhas-kar Bhas-kar commented Mar 3, 2025

Closes #15752

Fixed the invalid title/no title in Select component on hovering

Changelog

New

  • The default title for the component was not being set correctly, hence used useState to set the title by the default or the selectedItem value. onChange updates these title values.

Changed

To address the issue, the fix implements the following logic.

  • Prioritised Default Value: The code now first attempts to find a child option whose value matches the defaultValue prop. If found, this option's value is used as the default title.
  • Fallback to Selected/First Option: If no matching defaultValue is found, it falls back to using the value which is already selected, essentially the first in the valueSet, as the default title. This ensures that a title is always set.

Removed

  • None

Testing / Reviewing

  • Hover on Select component, it should show the selected Option as tooltip

  • If there's no option selected, tooltip should not show

@Bhas-kar Bhas-kar requested review from a team as code owners March 3, 2025 07:38
Copy link
Contributor

github-actions bot commented Mar 3, 2025

Thanks for your submission! We ask that you all sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text:


I have read the DCO document and I hereby sign the DCO.


1 out of 2 committers have signed the DCO.
✅ (kennylam)[https://github.com/kennylam]
@kanchi Bhaskar
Kanchi Bhaskar seems not to be a GitHub user. You need a GitHub account to be able to sign the DCO. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot.

@Bhas-kar
Copy link
Author

Bhas-kar commented Mar 3, 2025

I have read the DCO document and I hereby sign the DCO.

@Bhas-kar
Copy link
Author

Bhas-kar commented Mar 3, 2025

recheck

Copy link

netlify bot commented Mar 3, 2025

Deploy Preview for carbon-elements ready!

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

@Bhas-kar
Copy link
Author

Bhas-kar commented Mar 3, 2025

recheck

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]: Select component on hover shows invalid title/tooltip
2 participants