Skip to content

fix: make PermissionShield tooltip placement adaptive to viewport - #1776

Open
dhruveshmishra wants to merge 7 commits into
layer5io:masterfrom
dhruveshmishra:fixing-tools
Open

fix: make PermissionShield tooltip placement adaptive to viewport#1776
dhruveshmishra wants to merge 7 commits into
layer5io:masterfrom
dhruveshmishra:fixing-tools

Conversation

@dhruveshmishra

@dhruveshmishra dhruveshmishra commented Aug 5, 2026

Copy link
Copy Markdown

Fixes #1772

Summary

This PR fixes the PermissionShield tooltip (the permission warning popup) from getting cut off at the top of the screen or overlapping the fixed top header and left sidebar.

What I changed

  • Adaptive Positioning: Instead of staying locked at the top, the tooltip will now automatically flip to the right, bottom, or left depending on where there is more empty space.
  • Header & Sidebar Clearance: Added boundary rules telling the tooltip to stay clear of the fixed top navbar and left sidebar.
  • Under-Header Scrolling: Adjusted the tooltip's layer (zIndex) so it slides cleanly behind the top navbar when you scroll past it, instead of blocking it.

Screen recording

Screen.Recording.2026-08-05.at.10.47.09.PM.mov

Responsive:-

Screen.Recording.2026-08-11.at.1.56.04.AM.mov

Summary by CodeRabbit

Improvements

  • Permission tooltips now position themselves more reliably near screen edges, with improved flipping and overflow handling.
  • Added optional per-side boundary spacing controls for fine-tuned tooltip placement.
  • Tooltip dimensions, typography, labels, and spacing now adapt across screen sizes.
  • Long tooltip content can scroll within a capped height for easier viewing.
  • Improved layering and visual consistency help keep tooltip content accessible and readable.

Copilot AI lite review requested due to automatic review settings August 5, 2026 17:39
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The Permission Shield tooltip now supports responsive boundary padding, typography, dimensions, scrolling, and viewport-aware placement. Callers can override padding per side. Popper uses fallback placements and overflow handling.

Changes

Permission tooltip positioning

Layer / File(s) Summary
Configure responsive tooltip inputs and content
src/custom/permissions.tsx
PermissionShieldProps adds optional per-side boundaryPadding. The component merges mobile or desktop defaults with caller values. Tooltip typography, spacing, labels, and subtitles use responsive styling.
Configure adaptive tooltip placement
src/custom/permissions.tsx
The tooltip uses right-start placement, viewport boundaries, merged padding, bottom and top fallback placements, disabled tethering, alternate-axis handling, responsive dimensions, a maximum height, vertical scrolling, and a z-index style.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: rishiraj38

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adaptive viewport-based placement for the PermissionShield tooltip.
Linked Issues check ✅ Passed The changes implement adaptive placement, viewport constraints, boundary padding, and fallback directions required by issue #1772.
Out of Scope Changes check ✅ Passed The changes remain focused on PermissionShield tooltip positioning, viewport behavior, and responsive presentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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.

Copilot AI 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.

Pull request overview

Updates PermissionShield’s tooltip Popper configuration to better avoid viewport clipping and fixed UI chrome (top header / left sidebar) by tuning Popper modifiers and layering.

Changes:

  • Switches Popper configuration to use explicit popperOptions.modifiers with updated flip fallback order.
  • Adds viewport-boundary padding (top/left/right/bottom) and disables tether for preventOverflow.
  • Sets an explicit Popper zIndex via inline style to alter how the tooltip layers relative to other fixed UI.

Comment thread src/custom/permissions.tsx Outdated
Comment thread src/custom/permissions.tsx

@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

🤖 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-441: Update the tooltip positioning configuration around the
flip and preventOverflow modifiers so narrow viewports can accommodate the
tooltip’s minWidth. Replace the fixed left padding of 270 with responsive or
hidden-sidebar-aware padding, or conditionally make the tooltip width responsive
below the 578px breakpoint, while preserving the existing wide-layout behavior.
🪄 Autofix

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: e57928f4-f858-4b20-95cb-bc4575dc741d

📥 Commits

Reviewing files that changed from the base of the PR and between 38389a0 and 7be234c.

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

Comment thread src/custom/permissions.tsx Outdated
@dhruveshmishra
dhruveshmishra force-pushed the fixing-tools branch 3 times, most recently from d812240 to 986603a Compare August 5, 2026 17:57
…yer5io#1772)

Signed-off-by: dhruveshmishra <dhruveshmishra09@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@rishiraj38
rishiraj38 requested a review from Maanvi212006 August 6, 2026 08:07

@Maanvi212006 Maanvi212006 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is what all I tested:

  • Build, lint, and type-check all pass clean on the changed file (permissions.tsx); no regressions elsewhere.
  • Full test suite: 493/493 passing
  • Verified both bot review comments (Copilot's zIndex risk, CodeRabbit's hardcoded padding) are actually fixed in the current code, not just claimed.

@Maanvi212006 Maanvi212006 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The tooltip does not render properly across different viewport sizes

WhatsApp.Video.2026-08-09.at.4.05.07.AM.mp4

…sive

Signed-off-by: dhruveshmishra <dhruveshmishra09@gmail.com>
@dhruveshmishra

Copy link
Copy Markdown
Author

Thanks @Maanvi212006 for your suggestion , I have fixed the responsive problem u can take a look.

…nd zIndex

Signed-off-by: dhruveshmishra <dhruveshmishra09@gmail.com>
Signed-off-by: Dhruvesh Mishra <dhruveshmishra09@gmail.com>

@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.

Caution

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

⚠️ Outside diff range comments (4)
src/custom/permissions.tsx (4)

127-175: 🎯 Functional Correctness | 🔴 Critical | 🏗️ Heavy lift

Restore the PermissionSessionContext declaration.

Line 127 declares PermissionShield, but Line 571 declares PermissionShield again. The first declaration also reads displayedKeys, subtitle, setOpen, and uniqueId without declaring them in its visible props or scope. Line 617 references PermissionSessionContext, but this file does not declare that symbol. Split these components correctly before merge.

Also applies to: 571-621

🤖 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 127 - 175, Restore the
PermissionSessionContext declaration and separate the two PermissionShield
implementations into their intended component boundaries. Update the first
PermissionShield to use only values declared in its props or scope, including
displayedKeys, subtitle, setOpen, and uniqueId, while preserving the later
component’s PermissionSessionContext usage. Remove or relocate the duplicate
declaration so each component and context is defined exactly once.

650-668: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add left-start to fallbackPlacements. The explicit Popper fallback list replaces the default list, so the tooltip cannot use a left placement unless left-start is included.

🤖 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 650 - 668, Update the Popper `flip`
modifier configuration in the permissions tooltip to include `left-start` in
`fallbackPlacements`, preserving the existing fallback placements and other
modifier options.

274-275: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Restore balanced JSX tags.

Biome cannot find corresponding closing tags for React.Fragment and Box beginning on Lines 274-275. The module cannot parse until the JSX tree is corrected.

🤖 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 274 - 275, Complete the JSX tree in
the permission-rendering block beginning with React.Fragment and Box by adding
the corresponding closing tags in the correct nesting order. Ensure every opened
element, including React.Fragment and Box, is closed so the module parses
successfully.

Source: Linters/SAST tools


181-209: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use Sistent semantic color tokens throughout the permission UI.

The new styles mix MUI palette values with literal white and RGBA colors. In variant="card", background.paper can be light while the subtitle and key content remain forced to white, which can make permission details unreadable.

  • src/custom/permissions.tsx#L181-L209: derive card and tooltip palette roles from Sistent theme exports.
  • src/custom/permissions.tsx#L243-L252: use the derived subtitle color instead of literal white.
  • src/custom/permissions.tsx#L313-L338: use derived key and description colors instead of literal white and RGBA values.
  • src/custom/permissions.tsx#L640-L681: replace literal tooltip background, foreground, border, and shadow colors with semantic tokens.

As per coding guidelines, “Theme-aware UI must use Sistent theme exports and semantic palette tokens rather than raw MUI defaults.”

🤖 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 181 - 209, Replace raw MUI palette
values and literal white/RGBA colors in the permission UI with Sistent semantic
theme tokens. In src/custom/permissions.tsx lines 181-209, derive both card and
tooltip palette roles from Sistent theme exports; update lines 243-252 to use
the derived subtitle color, lines 313-338 to use derived key and description
colors, and lines 640-681 to use semantic tokens for tooltip background,
foreground, border, and shadow.

Source: Coding guidelines

🤖 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.

Outside diff comments:
In `@src/custom/permissions.tsx`:
- Around line 127-175: Restore the PermissionSessionContext declaration and
separate the two PermissionShield implementations into their intended component
boundaries. Update the first PermissionShield to use only values declared in its
props or scope, including displayedKeys, subtitle, setOpen, and uniqueId, while
preserving the later component’s PermissionSessionContext usage. Remove or
relocate the duplicate declaration so each component and context is defined
exactly once.
- Around line 650-668: Update the Popper `flip` modifier configuration in the
permissions tooltip to include `left-start` in `fallbackPlacements`, preserving
the existing fallback placements and other modifier options.
- Around line 274-275: Complete the JSX tree in the permission-rendering block
beginning with React.Fragment and Box by adding the corresponding closing tags
in the correct nesting order. Ensure every opened element, including
React.Fragment and Box, is closed so the module parses successfully.
- Around line 181-209: Replace raw MUI palette values and literal white/RGBA
colors in the permission UI with Sistent semantic theme tokens. In
src/custom/permissions.tsx lines 181-209, derive both card and tooltip palette
roles from Sistent theme exports; update lines 243-252 to use the derived
subtitle color, lines 313-338 to use derived key and description colors, and
lines 640-681 to use semantic tokens for tooltip background, foreground, border,
and shadow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 32ad6797-9f5f-439a-95d4-9cf2645b908f

📥 Commits

Reviewing files that changed from the base of the PR and between 71ba605 and 6d6ff0e.

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

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.

[UI] Permission Shield tooltip uses fixed placement="top" instead of adaptive placement

3 participants