fix: add workaround for safari + position: relative on <tr>#1579
fix: add workaround for safari + position: relative on <tr>#1579serhalp merged 2 commits intonpmx-dev:mainfrom
position: relative on <tr>#1579Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
position: relative on <tr> elementsposition: relative on <tr> elements
position: relative on <tr> elementsposition: relative on <tr> elements
📝 WalkthroughWalkthroughThe change modifies the Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/components/Package/TableRow.vue (1)
47-47: Thetransformclass is redundant alongsidescale-100.In UnoCSS preset-wind4,
scale-100emits the CSSscaleproperty directly and does not depend on thetransformutility. Thetransformutility sets a separatetransform:property for rotate and skew variables. Having both together adds unnecessary class noise without functional benefit.Consider removing
transformand keeping onlyscale-100.
| <template> | ||
| <tr | ||
| class="group relative border-b border-border hover:bg-bg-muted transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-inset focus-visible:outline-none focus:bg-bg-muted" | ||
| class="group relative transform scale-100 border-b border-border hover:bg-bg-muted transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-inset focus-visible:outline-none focus:bg-bg-muted" |
There was a problem hiding this comment.
Consider adding clip-path: inset(0) to fully contain the last row's overlay in Safari.
The CSS transform correctly establishes a containing block on <tr> in Safari (where position: relative is ignored), which is the right approach. However, the blog post referenced in the PR description explicitly notes that after adding the transform, "the last link's clickable area expands below the table" in Safari — i.e. the last row's ::after overlay can still overflow the table's bottom edge. The complete solution recommended in that post uses transform: translate(0) alongside clip-path: inset(0) on tr.
The existing focus-visible:ring-inset on the <tr> already draws the ring inward, so it remains fully visible under clip-path: inset(0).
🛡️ Proposed addition
- class="group relative transform scale-100 border-b border-border hover:bg-bg-muted transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-inset focus-visible:outline-none focus:bg-bg-muted"
+ class="group relative transform scale-100 [clip-path:inset(0)] border-b border-border hover:bg-bg-muted transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-inset focus-visible:outline-none focus:bg-bg-muted"Or if a scoped CSS rule is preferred (mirrors the existing <style scoped> block):
tr {
transform: scale(1);
+ clip-path: inset(0);
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| class="group relative transform scale-100 border-b border-border hover:bg-bg-muted transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-inset focus-visible:outline-none focus:bg-bg-muted" | |
| class="group relative transform scale-100 [clip-path:inset(0)] border-b border-border hover:bg-bg-muted transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-inset focus-visible:outline-none focus:bg-bg-muted" |
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
There was a problem hiding this comment.
what do you think of this comment @RYGRIT?
I tested it locally and didn't encounter the overflow issue mentioned in the blog post (I haven't figured out why it didn't occur). However, I agree with adding [clip-path:inset(0)] as a defense. WebKit's handling of table borders and absolute positioning can differ across Safari versions, so explicitly clipping the overlay ensures it never goes off-line. I also removed the redundant transform class.
position: relative on <tr> elementsposition: relative on <tr>
🔗 Linked issue
Fixes: #1554
🧭 Context
Safari doesn't support
position: relativeon<tr>elements📚 Description