Skip to content

Fix: Move action buttons to sticky footer in AddChargeItemsBillingSheet #16099#16118

Closed
niyati10000 wants to merge 1 commit intoohcnetwork:developfrom
niyati10000:issues/16099/fix-scroll-issue
Closed

Fix: Move action buttons to sticky footer in AddChargeItemsBillingSheet #16099#16118
niyati10000 wants to merge 1 commit intoohcnetwork:developfrom
niyati10000:issues/16099/fix-scroll-issue

Conversation

@niyati10000
Copy link

@niyati10000 niyati10000 commented Mar 16, 2026

Proposed Changes

Fixes #16099

  • Moved the "Cancel" and "Add Items" buttons from inside the ScrollArea to a sticky SheetFooter.
  • This ensures the action buttons remain visible at the bottom of the sheet even when many items are added and the list scrolls.
  • Verified that the buttons stay fixed on both desktop and mobile views.

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

[x] Complete QA on desktop devices.

[x] Request peer reviews.

Summary by CodeRabbit

  • Style
    • Redesigned the billing sheet layout with a persistent, sticky footer containing action buttons. These controls now remain visible and accessible while scrolling through the billing item list, ensuring critical actions are always within reach and improving billing efficiency.

@niyati10000 niyati10000 requested review from a team March 16, 2026 10:11
@github-actions
Copy link

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.

Your PR will be reviewed once you have marked the appropriate checklist items.

To update the checklist:

  • Change - [ ] to - [x] for completed items
  • Only check items that are relevant to your PR
  • Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 16, 2026

Walkthrough

The AddChargeItemsBillingSheet component was refactored to introduce a persistent footer area containing action buttons. Action buttons were relocated from inside the ScrollArea to a SheetFooter component positioned as a fixed, sticky footer. ScrollArea padding was adjusted accordingly, and button layout was simplified while preserving disabled states and shortcut badge behavior.

Changes

Cohort / File(s) Summary
UI Component Restructuring
src/pages/Facility/billing/account/components/AddChargeItemsBillingSheet.tsx
Added SheetFooter import and moved Cancel/Add Items action buttons from ScrollArea to a sticky fixed footer. Removed pb-12 padding from ScrollArea and adjusted layout structure for improved scrollability and persistent action visibility.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description covers the main changes and references the linked issue, but is missing several checklist items (specs/tests, documentation, i18n, changelog, Playwright tests) that are marked incomplete. Complete the merge checklist by adding specs/Playwright tests, updating documentation, ensuring I18n compliance, and preparing a changelog entry with screenshots.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix: Move action buttons to sticky footer in AddChargeItemsBillingSheet #16099' clearly and specifically describes the main change—moving buttons to a sticky footer to fix the scroll issue.
Linked Issues check ✅ Passed The PR successfully addresses the core requirement from #16099: moving action buttons to a sticky footer to keep them visible when scrolling the item list.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the scroll issue by restructuring the component layout with SheetFooter and adjusting padding—no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can use oxc to improve the quality of JavaScript and TypeScript code reviews.

Add a configuration file to your project to customize how CodeRabbit runs oxc.

@greptile-apps
Copy link

greptile-apps bot commented Mar 16, 2026

Greptile Summary

This PR fixes a UX issue where the "Cancel" and "Add Items" action buttons were buried inside the ScrollArea, causing them to scroll out of view when many charge items were added. The fix moves the buttons outside the ScrollArea into a SheetFooter, which is correct and makes the buttons persistently visible.

The overall approach is sound. A few small styling issues are worth addressing:

  • gap-2 added to SheetFooter will stack with the component's built-in sm:space-x-2 default, doubling the gap between buttons on sm+ screens since tailwind-merge does not treat these as conflicting utilities.
  • sticky bottom-0 is redundant: because SheetContent is fixed with flex flex-col and ScrollArea has flex-1, the footer is already pinned at the bottom naturally.
  • bg-white on the footer lacks a dark mode counterpart (dark:bg-gray-950), causing a visual mismatch in dark mode.

Confidence Score: 4/5

  • Safe to merge with minor style fixes recommended before landing.
  • The functional change (moving buttons to the footer) is correct and resolves the original bug. The only issues are minor styling concerns — double spacing on wider screens, a redundant sticky class, and a missing dark mode color — none of which affect functionality or introduce regressions.
  • src/pages/Facility/billing/account/components/AddChargeItemsBillingSheet.tsx — review the SheetFooter className for the spacing and dark mode issues.

Important Files Changed

Filename Overview
src/pages/Facility/billing/account/components/AddChargeItemsBillingSheet.tsx Moves Cancel/Add Items buttons from inside ScrollArea to a SheetFooter outside it; minor issues with redundant sticky bottom-0, double spacing from gap-2 + default sm:space-x-2, and missing dark mode equivalent for bg-white.

Last reviewed commit: 750da78

</div>
</ScrollArea>
{/* Fixed Footer with Action Buttons */}
<SheetFooter className="p-4 border-t bg-white sticky bottom-0 flex-row justify-end gap-2">
Copy link

Choose a reason for hiding this comment

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

Double spacing on sm screens from gap-2 + sm:space-x-2

SheetFooter applies sm:space-x-2 by default (via cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className) in sheet.tsx). Since tailwind-merge does not treat gap-* and space-x-* as conflicting utilities (they produce different CSS properties), both will be applied simultaneously on sm and larger breakpoints — resulting in ~8px of margin-left from space-x-2 stacked on top of the 8px gap-2, giving roughly 16px of total spacing between the two buttons instead of the intended 8px.

To fix this, either negate the default sm:space-x-2 or don't add gap-2 here and instead rely on the default:

Suggested change
<SheetFooter className="p-4 border-t bg-white sticky bottom-0 flex-row justify-end gap-2">
<SheetFooter className="p-4 border-t bg-white sticky bottom-0 flex-row justify-end gap-2 sm:space-x-0">

</div>
</ScrollArea>
{/* Fixed Footer with Action Buttons */}
<SheetFooter className="p-4 border-t bg-white sticky bottom-0 flex-row justify-end gap-2">
Copy link

Choose a reason for hiding this comment

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

sticky bottom-0 is redundant in this layout

SheetContent is already a fixed-position element with flex flex-col and h-full (from inset-y-0). ScrollArea has flex-1, so it consumes all remaining vertical space — the SheetFooter naturally sits at the bottom of the visible panel as the next flex sibling, with no ability to scroll past it. The sticky bottom-0 class has no practical effect here and may be misleading.

Consider removing sticky bottom-0 to keep the intent clear:

Suggested change
<SheetFooter className="p-4 border-t bg-white sticky bottom-0 flex-row justify-end gap-2">
<SheetFooter className="p-4 border-t bg-white flex-row justify-end gap-2 sm:space-x-0">

</div>
</ScrollArea>
{/* Fixed Footer with Action Buttons */}
<SheetFooter className="p-4 border-t bg-white sticky bottom-0 flex-row justify-end gap-2">
Copy link

Choose a reason for hiding this comment

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

Missing dark mode background on footer

bg-white is hardcoded without a dark-mode counterpart. The SheetContent base styles include dark:bg-gray-950, so on dark mode the footer background will visually mismatch the panel. Consider pairing it with a dark mode class:

Suggested change
<SheetFooter className="p-4 border-t bg-white sticky bottom-0 flex-row justify-end gap-2">
<SheetFooter className="p-4 border-t bg-white dark:bg-gray-950 sticky bottom-0 flex-row justify-end gap-2 sm:space-x-0">

@github-actions
Copy link

🚀 Preview Deployment Ready!

🔗 Preview URL: https://pr-16118.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.

Copy link
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/pages/Facility/billing/account/components/AddChargeItemsBillingSheet.tsx`:
- Line 378: The SheetFooter’s className is forcing desktop-only layout and a
hardcoded color; remove the literal "flex-row" and "bg-white" from the
SheetFooter className in AddChargeItemsBillingSheet so the component retains its
mobile-first stacked behavior and theme/contrast support, replace "flex-row"
with a responsive class like "sm:flex-row" (or "md:flex-row" if preferred) to
enable horizontal layout only on larger screens, and swap "bg-white" for a
semantic background token used in the app (e.g., "bg-surface" or
"bg-background") to preserve theme and high-contrast modes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c8f19f22-f58b-4d32-afff-541b169041d3

📥 Commits

Reviewing files that changed from the base of the PR and between 515ca53 and 750da78.

📒 Files selected for processing (1)
  • src/pages/Facility/billing/account/components/AddChargeItemsBillingSheet.tsx

</div>
</ScrollArea>
{/* Fixed Footer with Action Buttons */}
<SheetFooter className="p-4 border-t bg-white sticky bottom-0 flex-row justify-end gap-2">
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid overriding footer responsiveness and hardcoded background on Line 378.

flex-row overrides SheetFooter’s mobile-friendly default stacking, and bg-white can break theme/high-contrast behavior. Keep responsive defaults and use semantic background tokens.

Proposed fix
-        <SheetFooter className="p-4 border-t bg-white sticky bottom-0 flex-row justify-end gap-2">
+        <SheetFooter className="sticky bottom-0 border-t bg-background p-4 gap-2">

As per coding guidelines, "Use Tailwind's responsive classes and follow mobile-first approach" and "Include high contrast support for visibility in various clinical lighting conditions."

📝 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
<SheetFooter className="p-4 border-t bg-white sticky bottom-0 flex-row justify-end gap-2">
<SheetFooter className="sticky bottom-0 border-t bg-background p-4 gap-2">
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/Facility/billing/account/components/AddChargeItemsBillingSheet.tsx`
at line 378, The SheetFooter’s className is forcing desktop-only layout and a
hardcoded color; remove the literal "flex-row" and "bg-white" from the
SheetFooter className in AddChargeItemsBillingSheet so the component retains its
mobile-first stacked behavior and theme/contrast support, replace "flex-row"
with a responsive class like "sm:flex-row" (or "md:flex-row" if preferred) to
enable horizontal layout only on larger screens, and swap "bg-white" for a
semantic background token used in the app (e.g., "bg-surface" or
"bg-background") to preserve theme and high-contrast modes.

@Jacobjeevan
Copy link
Contributor

Please do not open a PR until issue is assigned to you.

@Master-112005
Copy link

Hi @maintainers,

I went through the previous PR (#16118) and the related discussions. The approach of moving the action buttons into a SheetFooter makes sense and correctly addresses the main issue.

However, I noticed a few follow-up improvements based on the review comments:

  • Avoid double spacing caused by combining gap-* and sm:space-x-*
  • Remove redundant sticky bottom-0 since the layout already ensures footer positioning
  • Add proper dark mode support instead of hardcoding bg-white
  • Preserve responsive behavior by not overriding default flex styles of SheetFooter

I’d like to work on refining this implementation by addressing these issues while keeping the fix minimal and aligned with existing UI patterns.

Please let me know if I can proceed with this improvement.

@github-actions github-actions bot added needs-triage question Further information is requested labels Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scroll is not there in “ Add Charge Item” sheet.

3 participants