Skip to content

fix(wework): anchor environment popover to trigger - #1834

Merged
qdaxb merged 1 commit into
mainfrom
agent/fix-wework-environment-popover
Jul 9, 2026
Merged

qdaxb merged 1 commit into
mainfrom
agent/fix-wework-environment-popover

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Anchor the Wework environment info popover to the clicked trigger instead of a fixed viewport position.
  • Recompute the popover position on resize and scroll while it is open.
  • Add coverage to prevent the popover from regressing to the hard-coded right/top placement.

Root Cause

The environment info popover was rendered through a portal with fixed right-6 top-[76px] classes, so clicking the environment button from a different toolbar area still opened the popover near the viewport edge.

Validation

  • pnpm --filter wework exec eslint src/components/layout/EnvironmentInfoPopover.tsx src/components/layout/workspace-panels/WorkspacePanelActions.test.tsx
  • pnpm --filter wework test -- WorkspacePanelActions.test.tsx
  • pre-push hook: Wework ESLint, TypeScript, and unit tests passed

Docs were checked and are not needed for this UI bugfix because it does not change API, configuration, or documented workflows.

Summary by CodeRabbit

  • Bug Fixes
    • The environment info popover now opens in a position that better matches the trigger button and stays within the visible screen area.
    • The popover updates its placement when the window is resized or scrolled, helping keep it visible and aligned.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7691c016-1c07-4412-ae1e-ac655979b299

📥 Commits

Reviewing files that changed from the base of the PR and between 80faa22 and fd2247c.

📒 Files selected for processing (2)
  • wework/src/components/layout/EnvironmentInfoPopover.tsx
  • wework/src/components/layout/workspace-panels/WorkspacePanelActions.test.tsx

📝 Walkthrough

Walkthrough

EnvironmentInfoPopover now computes its position dynamically from the anchor element's bounding rect instead of using static CSS placement, updating on open, window resize, and scroll events via new state and helper logic. Corresponding tests validate the computed left/top inline styles and absence of static placement classes.

Changes

Environment Info Popover Positioning

Layer / File(s) Summary
Position calculation logic and state
wework/src/components/layout/EnvironmentInfoPopover.tsx
Adds useCallback/CSSProperties imports, positioning constants, PopoverPosition type, clamp helper, getEnvironmentPopoverPosition function, and popoverPosition state.
Position wiring, listeners, and render
wework/src/components/layout/EnvironmentInfoPopover.tsx
Updates handleToggleOpen and adds updatePopoverPosition, registers resize/scroll listeners with cleanup tied to open, computes popoverStyle, and applies it inline while removing hard-coded right/top classes.
Tests for computed positioning
wework/src/components/layout/workspace-panels/WorkspacePanelActions.test.tsx
Adds createRect helper and a test spying on getBoundingClientRect to verify the popover's computed left/top inline styles and absence of edge-positioning classes.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant EnvironmentInfoPopover
  participant Window
  User->>EnvironmentInfoPopover: click trigger
  EnvironmentInfoPopover->>EnvironmentInfoPopover: handleToggleOpen computes popoverPosition from rootRef
  EnvironmentInfoPopover->>EnvironmentInfoPopover: render popover with popoverStyle
  Window->>EnvironmentInfoPopover: resize/scroll event
  EnvironmentInfoPopover->>EnvironmentInfoPopover: updatePopoverPosition recomputes position
  EnvironmentInfoPopover->>EnvironmentInfoPopover: update popoverStyle
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/fix-wework-environment-popover

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.

@qdaxb
qdaxb marked this pull request as ready for review July 9, 2026 07:59
@qdaxb
qdaxb merged commit 9127fe5 into main Jul 9, 2026
20 of 21 checks passed
@qdaxb
qdaxb deleted the agent/fix-wework-environment-popover branch July 9, 2026 07:59
@coderabbitai coderabbitai Bot mentioned this pull request Jul 24, 2026
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.

1 participant