Yuchen Yuan Claude Opus 4.7 commited on
Commit
74c84e9
·
1 Parent(s): fcc6a3d

Papers popover: restore mobile fixed-to-viewport anchoring

Browse files

On narrow screens the Papers button sits mid-header, so pure
`absolute right-0` pushes the 22rem popover's left edge off-screen.
Re-enable `fixed right-3 top-14` for <sm; desktop keeps the
absolute-to-button anchoring.

The header's new `z-20` means a `fixed` child inside it stacks above
the canvas without the stacking-context trouble we saw earlier.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Files changed (1) hide show
  1. frontend/src/components/TopBar.tsx +10 -8
frontend/src/components/TopBar.tsx CHANGED
@@ -236,16 +236,18 @@ function PapersPopover() {
236
  <span className="hidden sm:inline">Papers</span>
237
  </button>
238
  {open && (
239
- // Same positioning strategy as ThemeSwitcher: absolute right-0
240
- // of the button so the menu tracks with the header cluster, and
241
- // `w-[min(22rem,100vw-1.5rem)]` caps the width on narrow screens
242
- // so it can't overflow the viewport's right edge. We do NOT use
243
- // `position: fixed` here — fixed+z-index creates a new stacking
244
- // context that can land behind the React Flow canvas in the
245
- // backdrop-blur header's layer.
 
 
246
  <div
247
  role="menu"
248
- className="absolute right-0 top-full mt-1 rounded-lg border border-edge bg-surface shadow-xl z-30 p-2 flex flex-col gap-0.5 w-[min(22rem,calc(100vw-1.5rem))]"
249
  >
250
  {papers.map((p) => (
251
  <a
 
236
  <span className="hidden sm:inline">Papers</span>
237
  </button>
238
  {open && (
239
+ // Mobile (<sm): Papers button sits mid-header, so anchoring
240
+ // `absolute right-0` to the button pushes the 22rem popover
241
+ // off-screen on the left. Pin the popover to the viewport's
242
+ // right edge with `fixed right-3 top-14` so it always stays
243
+ // visible. The header itself is `z-20`, so a `fixed` child
244
+ // with z-index stacks above the canvas without trouble.
245
+ //
246
+ // Desktop (≥sm): back to anchor-to-button behaviour so the
247
+ // popover tracks with the Papers button in the header cluster.
248
  <div
249
  role="menu"
250
+ className="fixed right-3 top-14 sm:absolute sm:right-0 sm:top-full sm:mt-1 rounded-lg border border-edge bg-surface shadow-xl z-30 p-2 flex flex-col gap-0.5 w-[min(22rem,calc(100vw-1.5rem))]"
251
  >
252
  {papers.map((p) => (
253
  <a