Skip to content

fix: increase z-index for CopyToClipboardButton#2701

Open
gameroman wants to merge 6 commits intonpmx-dev:mainfrom
gameroman:fix-increase-z-index-CopyToClipboardButton
Open

fix: increase z-index for CopyToClipboardButton#2701
gameroman wants to merge 6 commits intonpmx-dev:mainfrom
gameroman:fix-increase-z-index-CopyToClipboardButton

Conversation

@gameroman
Copy link
Copy Markdown
Contributor

@gameroman gameroman commented May 9, 2026

🔗 Linked issue

Closes #2700

🧭 Context

Before After
image image

📚 Description

Fixed CopyToClipboardButton's z-index

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment May 11, 2026 8:30am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview May 11, 2026 8:30am
npmx-lunaria Ignored Ignored May 11, 2026 8:30am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 2026

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 230d1ea1-c5fc-4761-956a-319849bd659a

📥 Commits

Reviewing files that changed from the base of the PR and between e748ae0 and 3c23514.

📒 Files selected for processing (2)
  • app/components/CopyToClipboardButton.vue
  • test/e2e/interactions.spec.ts
✅ Files skipped from review due to trivial changes (1)
  • app/components/CopyToClipboardButton.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/interactions.spec.ts

📝 Walkthrough

Summary by CodeRabbit

  • Style

    • Increased the visual stacking order of the copy-to-clipboard tooltip button so it reliably appears above other interface elements, improving visibility during hover.
  • Tests

    • Added an end-to-end test that hovers to reveal the copy-to-clipboard button and verifies multiple points across its area are visible and not occluded during interaction.

Walkthrough

Increases CopyToClipboardButton tooltip z-index from z-20 to z-70 and adds a Playwright E2E test that samples five points over the copy button on /package/vue to assert the button is not occluded.

Changes

Clipboard Button Z-Index & E2E Validation

Layer / File(s) Summary
Styling
app/components/CopyToClipboardButton.vue
Tooltip/button Tailwind z-index class changed from z-20 to z-70.
End-to-end test
test/e2e/interactions.spec.ts
New Package Page test: loads /package/vue, reveals the copy button, samples five points in its bounding box and asserts each point's elementFromPoint(...).closest('button[aria-label]') resolves to the button.

Suggested reviewers:

  • ghostdevv
  • serhalp
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and directly summarizes the main change: increasing the z-index for the CopyToClipboardButton component.
Description check ✅ Passed The description is related to the changeset, explaining the fix for the CopyToClipboardButton's z-index issue with before/after context images.
Linked Issues check ✅ Passed The code changes directly address issue #2700 by increasing the z-index from z-20 to z-70 in CopyToClipboardButton.vue, making the copy button visible above overlapping UI elements.
Out of Scope Changes check ✅ Passed All changes are in scope: the CopyToClipboardButton z-index fix addresses the linked issue, and the test additions validate the fix's effectiveness.

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

✨ 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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Comment thread app/components/CopyToClipboardButton.vue
Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
test/e2e/interactions.spec.ts (1)

119-129: ⚡ Quick win

Consider making the occlusion check more specific.

The current implementation verifies that the element at each point is within any button[aria-label], which could lead to false positives if another button with an aria-label attribute is added near the copy button in future UI changes.

For a more robust test, verify that the element at each point belongs specifically to the copy button by comparing its aria-label value.

♻️ Suggested refinement
+    // Get the specific aria-label to verify we're checking the right button
+    const ariaLabel = await copyButton.getAttribute('aria-label')
+    if (!ariaLabel) throw new Error('Copy button has no aria-label')
+
     for (const { x, y } of points) {
       const isOnTop = await page.evaluate(
-        ({ x, y }) => {
+        ({ x, y, expectedLabel }) => {
           const el = document.elementFromPoint(x, y)
-          // Ensure the element at this point is the button or contained within it
-          return el?.closest('button[aria-label]') !== null
+          const button = el?.closest('button[aria-label]')
+          return button?.getAttribute('aria-label') === expectedLabel
         },
-        { x, y },
+        { x, y, expectedLabel: ariaLabel },
       )
       expect(isOnTop, `Button is occluded at point (${x.toFixed(0)}, ${y.toFixed(0)})`).toBe(true)
     }
🤖 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 `@test/e2e/interactions.spec.ts` around lines 119 - 129, The occlusion check is
too broad because it accepts any button with an aria-label; update the loop that
uses page.evaluate (iterating over points) so the callback checks the element at
document.elementFromPoint(x,y) has a closest('button[aria-label]') whose
getAttribute('aria-label') strictly equals the copy button's expected aria-label
(e.g., the known label string for the copy button) instead of just testing for
non-null; keep using the same points array and expect message but assert that
the aria-label matches the specific copy button's label.
🤖 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.

Nitpick comments:
In `@test/e2e/interactions.spec.ts`:
- Around line 119-129: The occlusion check is too broad because it accepts any
button with an aria-label; update the loop that uses page.evaluate (iterating
over points) so the callback checks the element at
document.elementFromPoint(x,y) has a closest('button[aria-label]') whose
getAttribute('aria-label') strictly equals the copy button's expected aria-label
(e.g., the known label string for the copy button) instead of just testing for
non-null; keep using the same points array and expect message but assert that
the aria-label matches the specific copy button's label.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f97f8a16-985c-4393-98c4-8e68e24c042b

📥 Commits

Reviewing files that changed from the base of the PR and between 8d80a22 and 69e5534.

📒 Files selected for processing (1)
  • test/e2e/interactions.spec.ts

Comment thread test/e2e/interactions.spec.ts Outdated
await goto('/package/vue', { waitUntil: 'hydration' })

const packageHeading = page.locator('h1').first()
await expect(packageHeading).toBeVisible({ timeout: 15000 })
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.

is a 15s timeout really necessary ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Probably not, let me check

Does it matter in case only if it fails or how does it work?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Although, this matches timeouts for other tests I think, so I am not sure


for (const { x, y } of points) {
const isOnTop = await page.evaluate(
({ x, y }) => {
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.

Can you address this eslint warning ?
For example:

const isOnTop = await page.evaluate(
    ({ pointX, pointY }) => {
      const element = document.elementFromPoint(pointX, pointY)
      return element?.closest('button[aria-label]') !== null
    },
    { pointX: x, pointY: y },
  )

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.

bug: Copy package name is hidden under menu

2 participants