Skip to content

(fix) Make the whole label as tooltip trigger #475

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

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

Conversation

vasharma05
Copy link
Member

@vasharma05 vasharma05 commented Mar 13, 2025

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

Currently, the i icon is shown on the right hand of the label which is then used to trigger the tooltip. Now the tooltip rendered was getting cropped by the form's wrapper.

Now the whole label is made the tooltip trigger, along with displaying a i icon on the right side of the label.

Screenshots

Before

image

image

After

image

image

Related Issue

Other

Slack thread: https://openmrs.slack.com/archives/C04QZ5DDVMG/p1743764918799569

@vasharma05 vasharma05 requested a review from pirupius March 13, 2025 12:33
Copy link

github-actions bot commented Mar 13, 2025

Size Change: -266 kB (-16.02%) 👏

Total Size: 1.39 MB

Filename Size Change
dist/929.js 0 B -266 kB (removed) 🏆
ℹ️ View Unchanged
Filename Size Change
dist/151.js 444 kB 0 B
dist/184.js 6.82 kB 0 B
dist/225.js 2.58 kB 0 B
dist/262.js 114 kB 0 B
dist/277.js 1.85 kB 0 B
dist/353.js 3.02 kB 0 B
dist/41.js 3.04 kB 0 B
dist/422.js 3.37 kB 0 B
dist/469.js 69.9 kB 0 B
dist/499.js 2.51 kB 0 B
dist/522.js 34.3 kB 0 B
dist/540.js 2.63 kB 0 B
dist/606.js 2.23 kB 0 B
dist/635.js 14.4 kB 0 B
dist/689.js 266 kB 0 B
dist/993.js 3.09 kB 0 B
dist/main.js 416 kB -83 B (-0.02%)
dist/openmrs-esm-form-engine-lib.js 3.8 kB +2 B (+0.05%)

compressed-size-action

@vasharma05 vasharma05 force-pushed the fix/tooltip-alignment branch from cbf6db6 to 071c102 Compare April 4, 2025 11:30
@vasharma05 vasharma05 changed the title (fix) Change the alignment of the tooltip to right (fix) Make the whole label as tooltip trigger Apr 4, 2025
@vasharma05 vasharma05 force-pushed the fix/tooltip-alignment branch from 1538c46 to 887fd00 Compare April 10, 2025 10:29
@vasharma05 vasharma05 force-pushed the fix/tooltip-alignment branch from 887fd00 to 46a73c6 Compare April 10, 2025 10:29
const Tooltip: React.FC<{ field: FormField; children: React.ReactNode }> = ({ field, children }) => {
const { t } = useTranslation();
return (
<CarbonTooltip align="top-left" label={t(field.questionInfo)} defaultOpen>
Copy link
Member

Choose a reason for hiding this comment

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

I think defaultOpen should not be enabled.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought I removed this, apologies.

hasTooltip: boolean;
}

const FieldLabelContent: React.FC<FieldLabelContentProps> = ({ field, customLabel, hasTooltip }) => {
Copy link
Member

Choose a reason for hiding this comment

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

@vasharma05 Splitting these components feels overkill. Here is a simplified version: https://gist.github.com/samuelmale/daef56444bc7e8ea79c044dc842dec37

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.

3 participants