Skip to content

fix: prevent PermissionShield tooltip from getting clipped - #1771

Merged
rishiraj38 merged 2 commits into
layer5io:masterfrom
rishiraj38:fix/permission-shield-tooltip-viewport-clipping
Aug 4, 2026
Merged

fix: prevent PermissionShield tooltip from getting clipped#1771
rishiraj38 merged 2 commits into
layer5io:masterfrom
rishiraj38:fix/permission-shield-tooltip-viewport-clipping

Conversation

@rishiraj38

@rishiraj38 rishiraj38 commented Aug 4, 2026

Copy link
Copy Markdown
Member

Description

The PermissionShield tooltip gets clipped when rendered near viewport edges — especially on zoomed screens or when the shield icon is near the top/bottom of the screen (e.g. Identity section in the navigation menu with many sub-items).

Changes

Added Popper flip and preventOverflow modifiers to the PermissionShield tooltip:

  • flip: automatically repositions the tooltip from top to bottom, right, or left when there isn't enough space in the default placement direction
  • preventOverflow: constrains the tooltip within the viewport boundary with 8px padding on all axes

Testing

  • Tested locally with a zoomed-in screen where the Identity section PermissionShield tooltip was being cut off at both top and bottom
  • Tooltip now flips and stays fully visible within the viewport
  • All 492 existing tests pass

Before

Screenshot 2026-08-04 at 11 23 03 PM

After

Screen.Recording.2026-08-04.at.11.08.16.PM.mov

Signed-off-by: Rishi Raj <rishiraj438gt@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The permissions tooltip now selects fallback positions and prevents overflow using viewport boundaries, alternate-axis handling, and 8px padding.

Changes

Tooltip placement

Layer / File(s) Summary
Configure viewport-aware tooltip placement
src/custom/permissions.tsx
The Tooltip Popper configuration adds fallback positions below, right, and left. It also enables alternate-axis overflow handling with viewport boundaries and 8px padding.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: alexquincy, codeahmedjamil, leecalcote

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing the PermissionShield tooltip from being clipped.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/custom/permissions.tsx (1)

431-436: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use rootBoundary for the viewport constraint.

preventOverflow.rootBoundary is the typed Popper option for constraining the popper against 'viewport' or 'document'. Use it here instead of boundary: 'viewport'.

Proposed change
                   options: {
-                    boundary: 'viewport',
+                    rootBoundary: 'viewport',
                     altAxis: true,
                     padding: 8
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/custom/permissions.tsx` around lines 431 - 436, Update the
preventOverflow options in the permissions configuration to use the typed
rootBoundary option with the existing viewport constraint, replacing boundary
while preserving altAxis and padding.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/custom/permissions.tsx`:
- Around line 431-437: Update the tooltip styling near the preventOverflow
configuration to remove the fixed minWidth of 300 and make its width responsive
to the available viewport space, while preserving the existing 12px padding and
16px overflow boundary behavior. Ensure the tooltip can shrink on narrow or
zoomed viewports instead of clipping.

---

Nitpick comments:
In `@src/custom/permissions.tsx`:
- Around line 431-436: Update the preventOverflow options in the permissions
configuration to use the typed rootBoundary option with the existing viewport
constraint, replacing boundary while preserving altAxis and padding.
🪄 Autofix

❌ Autofix failed (check again to retry)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 99c7f071-a679-4f85-ac3d-96c01a554d1c

📥 Commits

Reviewing files that changed from the base of the PR and between 4e23298 and 4bf2bac.

📒 Files selected for processing (1)
  • src/custom/permissions.tsx

Comment on lines +431 to +437
name: 'preventOverflow',
enabled: true,
options: {
boundary: 'viewport',
altAxis: true,
padding: 8
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the tooltip width responsive.

preventOverflow can reposition the popper, but it cannot shrink it. The tooltip still sets minWidth: 300 at Line [446] and padding: '12px' at Line [447]. If the CSS viewport is narrower than the rendered tooltip width plus the 16px boundary padding, the tooltip still clips. This leaves the zoomed-screen case unresolved.

Proposed change
               sx={{
-                maxWidth: 360,
-                minWidth: 300,
+                boxSizing: 'border-box',
+                maxWidth: 'min(360px, calc(100vw - 16px))',
+                minWidth: 'min(300px, calc(100vw - 16px))',
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/custom/permissions.tsx` around lines 431 - 437, Update the tooltip
styling near the preventOverflow configuration to remove the fixed minWidth of
300 and make its width responsive to the available viewport space, while
preserving the existing 12px padding and 16px overflow boundary behavior. Ensure
the tooltip can shrink on narrow or zoomed viewports instead of clipping.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

An unexpected error occurred while generating fixes: Not Found - https://docs.github.com/rest/git/refs#get-a-reference

@rishiraj38
rishiraj38 merged commit 310d02f into layer5io:master Aug 4, 2026
2 of 3 checks passed
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.

2 participants