Skip to content

style(anchor): stabilize marker positioning during panel expansion - #409

Open
SonyLeo wants to merge 2 commits into
opentiny:developfrom
SonyLeo:style/anchor-item-padding
Open

style(anchor): stabilize marker positioning during panel expansion#409
SonyLeo wants to merge 2 commits into
opentiny:developfrom
SonyLeo:style/anchor-item-padding

Conversation

@SonyLeo

@SonyLeo SonyLeo commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

变更说明

  • 优化 Anchor 面板、列表项与 tooltip 的间距定位。
  • 使用 CSS 变量统一管理面板和目录项间距。
  • 将 marker 改为相对列表项绝对定位。
  • 修复右侧 Anchor 在收起态展开时 marker 向左移动的问题。
  • 调整收起态目录项内边距,避免窄宽度下发生横向溢出。

验证

  • Prettier 格式检查通过
  • ESLint 检查通过
  • vue-tsc 类型检查通过

截图对比

修改前

anchor-before

修改后

anchor-after

Summary by CodeRabbit

Style

  • Refined anchor navigation layout and spacing for improved alignment.
  • Standardized surface, item, and tooltip spacing with configurable styling values.
  • Improved marker positioning and expanded-state presentation.
  • Adjusted list padding, inline margins, and surface borders for a cleaner appearance.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 9b13032b-9dcd-48d6-8f5a-77a437615335

📥 Commits

Reviewing files that changed from the base of the PR and between 055fb38 and 286737f.

📒 Files selected for processing (1)
  • packages/components/src/anchor/components/AnchorItem.vue

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The anchor components now use shared CSS custom properties for surface padding, item padding, tooltip gaps, and marker positioning. List spacing and expanded or collapsed item layouts use the updated values.

Changes

Anchor layout

Layer / File(s) Summary
Surface spacing variables
packages/components/src/anchor/components/AnchorOverlay.vue, packages/components/src/anchor/components/AnchorList.vue
The overlay defines shared spacing variables. The surface uses variable horizontal padding, and the list uses a matching negative inline margin without vertical padding. Expanded surfaces no longer apply the anchor border.
Item and marker positioning
packages/components/src/anchor/components/AnchorItem.vue
Items use variable padding and tooltip gaps. Collapsed items remove inline padding. Marker slots use absolute positioning and calculated horizontal offsets.

Priority: ⬇️ Low

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

Merge Risk: ⚪ Minimal · up to 28673

This updates Anchor spacing and marker positioning, including collapsed-item hit-area handling. No unresolved merge-readiness risk remains.

Suggested reviewers: gene9831

🚥 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 summarizes the main change: stabilizing Anchor marker positioning during panel expansion. It is concise and specific.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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

A rabbit hops where anchors align
Shared spacing keeps the paths in line
Markers rest with gentle care
Padding shifts through CSS air
Expanded leaves and collapsed bends
Neat little layouts meet their ends

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

✅ Preview build completed successfully!

Click the image above to preview.
Preview will be automatically removed when this PR is closed.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@gene9831 gene9831 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

发现 1 个需要修正的交互回归:收起态目录项的按钮命中区域由原先约 30px 缩小到 16px。具体复现和修改建议见行内评论。

已在 PR Preview 验证左右 placement、hover/manual 收起态以及 360px 视口;marker 定位稳定,未发现额外横向溢出。当前 CI build、e2e 和 package preview 均通过,但仓库没有 Anchor 专项测试覆盖该命中区域。

Comment thread packages/components/src/anchor/components/AnchorItem.vue Outdated
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.

2 participants