Skip to content

Wrapped text in DiagnosticReportTable#15221

Merged
bodhish merged 2 commits intoohcnetwork:developfrom
SiddanthNayak:issues/dr-print-textwrap
Jan 21, 2026
Merged

Wrapped text in DiagnosticReportTable#15221
bodhish merged 2 commits intoohcnetwork:developfrom
SiddanthNayak:issues/dr-print-textwrap

Conversation

@SiddanthNayak
Copy link
Copy Markdown
Member

@SiddanthNayak SiddanthNayak commented Jan 19, 2026

Proposed Changes

Fixes #15220

  • Added text-wrap classes to table cells to wrap text instead of showing scrollbar
Screenshot 2026-01-19 at 11 17 19 AM Screenshot 2026-01-19 at 11 18 48 AM

Tagging: @ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate the bug or test the new feature.
  • Update product documentation.
  • Ensure that UI text is placed in I18n files.
  • Prepare a screenshot or demo video for the changelog entry and attach it to the issue.
  • Request peer reviews.
  • Complete QA on mobile devices.
  • Complete QA on desktop devices.
  • Add or update Playwright tests for related changes

Summary by CodeRabbit

  • Style
    • Improved text wrapping and layout in the Diagnostic Report Results Table for better readability of test results, values, units, and reference ranges.
    • Enhanced spacing and alignment between values and units.
    • Optimized table column width distribution for more consistent display.

✏️ Tip: You can customize this high-level summary in your review settings.

@SiddanthNayak SiddanthNayak requested review from a team and Copilot January 19, 2026 06:37
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 19, 2026

Walkthrough

Modified the DiagnosticReportResultsTable component to fix text wrapping behavior. Updated table cell layout and styling to use whitespace normalization and word-break properties instead of flex-based structures. Adjusted column widths and spacing to prevent scrollbars and enable proper text wrapping for values, units, and reference ranges.

Changes

Cohort / File(s) Summary
Diagnostic Report Results Table Styling
src/pages/Facility/services/diagnosticReports/components/DiagnosticReportResultsTable.tsx
Refactored table cell wrapping by replacing flex-based inner structures with whitespace-normal and wrap-break-word classes. Enforced 25% column widths on all header cells (test, result, reference_range, interpretation). Added ml-1 spacing to unit displays for better visual separation. Updated outer container from border-only to border with overflow-hidden and applied table-fixed class for stable column widths.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Wrapped text in DiagnosticReportTable' directly describes the main change made in the PR - adding text wrapping functionality to the table cells.
Description check ✅ Passed The PR description includes the issue fix reference (#15220), a clear summary of changes, visual evidence via screenshots, proper tagging, and addresses most merge checklist items appropriately.
Linked Issues check ✅ Passed The PR fixes issue #15220 by adding text-wrap classes to DiagnosticReport table cells, directly addressing the reported bug where scrollbars appeared instead of text wrapping.
Out of Scope Changes check ✅ Passed All changes are scoped to the DiagnosticReportResultsTable component and directly address the text wrapping issue; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements text wrapping in the DiagnosticReportTable to improve readability and eliminate horizontal scrolling. The change enhances the user experience by ensuring all table content is visible without requiring scrollbar interaction.

Changes:

  • Added text wrapping utilities (whitespace-normal, wrap-break-word) to table cells
  • Implemented fixed table layout with percentage-based column widths for consistent sizing
  • Adjusted spacing by replacing flexbox gap with margin for better text flow

<div className="w-2 h-px bg-gray-400" />
{component.code?.display}
</div>
<TableCell className="pl-4 border-r border-b border-gray-300 whitespace-normal wrap-break-word">
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The class 'wrap-break-word' is not a standard Tailwind CSS utility class. Use 'break-words' instead, which is the correct Tailwind utility for word breaking. This applies to all occurrences of 'wrap-break-word' in this file.

Copilot uses AI. Check for mistakes.
Comment on lines +108 to +109
<div className="w-2 h-px bg-gray-400" />
{component.code?.display}
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The removal of the flex container wrapper ('flex items-center gap-1') causes the decorative line and text to no longer be properly aligned. The original flex layout should be preserved to maintain the visual alignment of these elements.

Suggested change
<div className="w-2 h-px bg-gray-400" />
{component.code?.display}
<div className="flex items-center gap-1">
<div className="w-2 h-px bg-gray-400" />
<span>{component.code?.display}</span>
</div>

Copilot uses AI. Check for mistakes.
<TableCell className="border-r border-b border-gray-300">
<div className="flex items-center gap-2">
<TableCell className="border-r border-b border-gray-300 whitespace-normal wrap-break-word">
<div className="whitespace-normal">
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

Removing 'flex items-center gap-2' and only keeping 'whitespace-normal' may cause misalignment between the value and unit, especially when the text wraps. Consider using 'flex flex-wrap items-center' instead to maintain proper alignment while allowing wrapping.

Suggested change
<div className="whitespace-normal">
<div className="flex flex-wrap items-center whitespace-normal">

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pages/Facility/services/diagnosticReports/components/DiagnosticReportResultsTable.tsx (1)

146-173: Same invalid class in observation cells.

Apply the same fix here — replace wrap-break-word with break-words.

🐛 Proposed fix for observation cells
-          <TableCell className="whitespace-normal wrap-break-word">
+          <TableCell className="whitespace-normal break-words">
             {observation.observation_definition?.title ||
               observation.observation_definition?.code?.display}
           </TableCell>
-          <TableCell className="whitespace-normal wrap-break-word">
+          <TableCell className="whitespace-normal break-words">
             {!hasComponents && (
               <div className="whitespace-normal">
                 <span>{observation.value.value}</span>
                 {observation.value.unit && (
                   <span className="text-gray-500 ml-1">
                     {observation.value.unit.display}
                   </span>
                 )}
               </div>
             )}
           </TableCell>
-          <TableCell className="whitespace-normal wrap-break-word">
+          <TableCell className="whitespace-normal break-words">
             {!hasComponents &&
               renderReferenceRange(
                 observation.reference_range || [],
                 observation.value,
               )}
           </TableCell>
-          <TableCell className="whitespace-normal wrap-break-word">
+          <TableCell className="whitespace-normal break-words">
             {!hasComponents &&
               observation.interpretation &&
               renderInterpretation(observation.interpretation)}
           </TableCell>
🤖 Fix all issues with AI agents
In
`@src/pages/Facility/services/diagnosticReports/components/DiagnosticReportResultsTable.tsx`:
- Around line 107-127: The Tailwind class `wrap-break-word` used in the
TableCell elements is invalid so text won't wrap; update each TableCell in
DiagnosticReportResultsTable (the cells rendering component.code?.display,
component.value, reference_range, and interpretation) to replace
`wrap-break-word` with the correct Tailwind utility `break-words` (ensure all
occurrences in the className strings for those TableCell elements are changed).
- Around line 187-202: In DiagnosticReportResultsTable.tsx, replace the invalid
Tailwind class "wrap-break-word" used on the two TableHead elements with the
correct class (e.g., "break-words") so headers can wrap as intended; keep the
existing "whitespace-normal" and "w-[25%]" classes and update the two TableHead
nodes inside the TableHeader (the header cells rendering t("reference_range")
and t("interpretation")) to use "break-words" instead of "wrap-break-word".

Comment on lines +107 to 127
<TableCell className="pl-4 border-r border-b border-gray-300 whitespace-normal wrap-break-word">
<div className="w-2 h-px bg-gray-400" />
{component.code?.display}
</TableCell>
<TableCell className="border-r border-b border-gray-300">
<div className="flex items-center gap-2">
<TableCell className="border-r border-b border-gray-300 whitespace-normal wrap-break-word">
<div className="whitespace-normal">
<span>{component.value.value}</span>
{component.value.unit && (
<span className="text-gray-500">
<span className="text-gray-500 ml-1">
{component.value.unit.display}
</span>
)}
</div>
</TableCell>
<TableCell className="border-r border-b border-gray-300">
<TableCell className="border-r border-b border-gray-300 whitespace-normal wrap-break-word">
{component.reference_range &&
renderReferenceRange(component.reference_range, component.value)}
</TableCell>
<TableCell className="border-b border-gray-300">
<TableCell className="border-b border-gray-300 whitespace-normal wrap-break-word">
{renderInterpretation(component.interpretation || "")}
</TableCell>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Invalid Tailwind class wrap-break-word — text wrapping won't work.

wrap-break-word is not a valid Tailwind CSS utility. The correct class is break-words (which sets overflow-wrap: break-word). Since this PR's goal is to fix text wrapping, using a non-existent class means the fix won't work as intended.

🐛 Proposed fix for component cells
-        <TableCell className="pl-4 border-r border-b border-gray-300 whitespace-normal wrap-break-word">
+        <TableCell className="pl-4 border-r border-b border-gray-300 whitespace-normal break-words">
           <div className="w-2 h-px bg-gray-400" />
           {component.code?.display}
         </TableCell>
-        <TableCell className="border-r border-b border-gray-300 whitespace-normal wrap-break-word">
+        <TableCell className="border-r border-b border-gray-300 whitespace-normal break-words">
           <div className="whitespace-normal">
             <span>{component.value.value}</span>
             {component.value.unit && (
               <span className="text-gray-500 ml-1">
                 {component.value.unit.display}
               </span>
             )}
           </div>
         </TableCell>
-        <TableCell className="border-r border-b border-gray-300 whitespace-normal wrap-break-word">
+        <TableCell className="border-r border-b border-gray-300 whitespace-normal break-words">
           {component.reference_range &&
             renderReferenceRange(component.reference_range, component.value)}
         </TableCell>
-        <TableCell className="border-b border-gray-300 whitespace-normal wrap-break-word">
+        <TableCell className="border-b border-gray-300 whitespace-normal break-words">
           {renderInterpretation(component.interpretation || "")}
         </TableCell>
🤖 Prompt for AI Agents
In
`@src/pages/Facility/services/diagnosticReports/components/DiagnosticReportResultsTable.tsx`
around lines 107 - 127, The Tailwind class `wrap-break-word` used in the
TableCell elements is invalid so text won't wrap; update each TableCell in
DiagnosticReportResultsTable (the cells rendering component.code?.display,
component.value, reference_range, and interpretation) to replace
`wrap-break-word` with the correct Tailwind utility `break-words` (ensure all
occurrences in the className strings for those TableCell elements are changed).

Comment on lines +187 to 202
<div className="rounded-md border overflow-hidden">
<Table className="border-collapse bg-white shadow-sm cursor-default table-fixed w-full">
<TableHeader className="bg-gray-100">
<TableRow className="divide-x-1 divide-gray-300">
<TableHead className="font-medium text-sm text-gray-700">
<TableHead className="font-medium text-sm text-gray-700 w-[25%]">
{t("test")}
</TableHead>
<TableHead className="font-medium text-sm text-gray-700">
<TableHead className="font-medium text-sm text-gray-700 w-[25%]">
{t("result")}
</TableHead>
<TableHead className="font-medium text-sm text-gray-700">
<TableHead className="font-medium text-sm text-gray-700 w-[25%] whitespace-normal wrap-break-word">
{t("reference_range")}
</TableHead>
<TableHead className="font-medium text-sm text-gray-700">
<TableHead className="font-medium text-sm text-gray-700 w-[25%] whitespace-normal wrap-break-word">
{t("interpretation")}
</TableHead>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Table layout approach is good; fix invalid class in headers.

The table-fixed with explicit w-[25%] column widths and overflow-hidden on the container is a solid approach for controlled text wrapping. However, the same invalid wrap-break-word class needs to be fixed in the header cells.

🐛 Proposed fix for header cells
-            <TableHead className="font-medium text-sm text-gray-700 w-[25%] whitespace-normal wrap-break-word">
+            <TableHead className="font-medium text-sm text-gray-700 w-[25%] whitespace-normal break-words">
               {t("reference_range")}
             </TableHead>
-            <TableHead className="font-medium text-sm text-gray-700 w-[25%] whitespace-normal wrap-break-word">
+            <TableHead className="font-medium text-sm text-gray-700 w-[25%] whitespace-normal break-words">
               {t("interpretation")}
             </TableHead>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="rounded-md border overflow-hidden">
<Table className="border-collapse bg-white shadow-sm cursor-default table-fixed w-full">
<TableHeader className="bg-gray-100">
<TableRow className="divide-x-1 divide-gray-300">
<TableHead className="font-medium text-sm text-gray-700">
<TableHead className="font-medium text-sm text-gray-700 w-[25%]">
{t("test")}
</TableHead>
<TableHead className="font-medium text-sm text-gray-700">
<TableHead className="font-medium text-sm text-gray-700 w-[25%]">
{t("result")}
</TableHead>
<TableHead className="font-medium text-sm text-gray-700">
<TableHead className="font-medium text-sm text-gray-700 w-[25%] whitespace-normal wrap-break-word">
{t("reference_range")}
</TableHead>
<TableHead className="font-medium text-sm text-gray-700">
<TableHead className="font-medium text-sm text-gray-700 w-[25%] whitespace-normal wrap-break-word">
{t("interpretation")}
</TableHead>
<div className="rounded-md border overflow-hidden">
<Table className="border-collapse bg-white shadow-sm cursor-default table-fixed w-full">
<TableHeader className="bg-gray-100">
<TableRow className="divide-x-1 divide-gray-300">
<TableHead className="font-medium text-sm text-gray-700 w-[25%]">
{t("test")}
</TableHead>
<TableHead className="font-medium text-sm text-gray-700 w-[25%]">
{t("result")}
</TableHead>
<TableHead className="font-medium text-sm text-gray-700 w-[25%] whitespace-normal break-words">
{t("reference_range")}
</TableHead>
<TableHead className="font-medium text-sm text-gray-700 w-[25%] whitespace-normal break-words">
{t("interpretation")}
</TableHead>
🤖 Prompt for AI Agents
In
`@src/pages/Facility/services/diagnosticReports/components/DiagnosticReportResultsTable.tsx`
around lines 187 - 202, In DiagnosticReportResultsTable.tsx, replace the invalid
Tailwind class "wrap-break-word" used on the two TableHead elements with the
correct class (e.g., "break-words") so headers can wrap as intended; keep the
existing "whitespace-normal" and "w-[25%]" classes and update the two TableHead
nodes inside the TableHeader (the header cells rendering t("reference_range")
and t("interpretation")) to use "break-words" instead of "wrap-break-word".

@github-actions
Copy link
Copy Markdown

🚀 Preview Deployment Ready!

🔗 Preview URL: https://pr-15221.care-preview-a7w.pages.dev

📱 Mobile Access:
Scan the QR code below to open the preview on your mobile device.

QR Code


This preview will be automatically updated when you push new commits to this PR.

@github-actions
Copy link
Copy Markdown

🎭 Playwright Test Results

Status: ❌ Failed
Test Shards: 3

Metric Count
Total Tests 171
✅ Passed 161
❌ Failed 10
⏭️ Skipped 0

📊 Detailed results are available in the playwright-final-report artifact.

Run: #4908

@bodhish bodhish merged commit 9c4bc7c into ohcnetwork:develop Jan 21, 2026
23 of 29 checks passed
@github-actions
Copy link
Copy Markdown

@SiddanthNayak Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

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.

Diagnostic Report/lab print - scrollbar appearing instead of text wrap for text values

4 participants