Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(site): fix Popper layers separate when scrolling through document #2502

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

shenjunjian
Copy link
Collaborator

@shenjunjian shenjunjian commented Nov 8, 2024

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

修复弹出层分离的问题。 调整组件页面的滚动元素, 改为 #doc-layout-scroller

以后整改时,可以通过 $refs 去访问 #doc-layout-scroller元素了

统一tiny-popper的样式

Summary by CodeRabbit

  • New Features

    • Introduced a collapsible menu with enhanced filtering capabilities for improved navigation.
    • Added functionality for dynamic menu state management based on user interactions and route changes.
    • Enhanced documentation layout for better user experience.
  • Bug Fixes

    • Updated scrolling behavior to ensure accurate targeting of the new scrollable area.
  • Style

    • Adjusted CSS for improved layout and visibility across different screen sizes.
    • Improved visual consistency for popper components with new styling rules.

Copy link

coderabbitai bot commented Nov 8, 2024

Walkthrough

The changes in this pull request involve significant modifications to the components.vue, layout.vue, and reset.less files. In components.vue, the template structure has been updated with a new ID for a scrollable area, affecting scrolling behavior and layout. In layout.vue, enhancements include new properties for the tiny-tree-menu, improved routing methods, and refined filtering logic. Additionally, reset.less introduces new styles for popper components, enhancing visual consistency. These changes collectively aim to improve user navigation and the overall responsiveness of the documentation interface.

Changes

File Path Change Summary
examples/sites/src/views/components.vue - Added id="doc-layout-scoller" to <div class="docs-content">.
- Updated references from doc-layout to doc-layout-scoller in JavaScript functions.
- Moved footer to be a sibling of the main content div.
examples/sites/src/views/layout/layout.vue - Introduced tiny-tree-menu with new properties for enhanced interaction.
- Updated clickMenu, getMenuLink, and searchMenu methods.
- Added collapseChange method for menu state management.
- Adjusted CSS styles for layout responsiveness.
packages/theme/src/base/reset.less - Added styles for .tiny-popper with margin adjustments.
- Consolidated styles for popper components with arrows, defining their appearance and positioning.

Possibly related PRs

Suggested reviewers

  • zzcr
  • kagol

🐇 In a world of docs and scrolls,
A rabbit hops where knowledge rolls.
With menus that dance and layouts that gleam,
Navigation's a breeze, like a sweet dream.
So let’s celebrate with a joyful cheer,
For changes that make our path so clear! 🐰✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 608167c and 09aac2b.

📒 Files selected for processing (1)
  • packages/theme/src/base/reset.less (1 hunks)
🔇 Additional comments (3)
packages/theme/src/base/reset.less (3)

180-197: LGTM! Consistent margin handling for poppers without arrows.

The implementation provides a uniform 4px margin for all placement directions, which helps maintain visual consistency across different components (select, userlink, roles, dept).


Line range hint 203-248: LGTM! Improved arrow implementation with better visual control.

The switch from border-based to div-based arrows is a good improvement:

  • Better control over arrow dimensions and appearance
  • Consistent positioning across different placements
  • Clear z-index handling to prevent overlay issues

The implementation aligns well with the PR objective of fixing popper layer separation during scrolling.


199-202: Verify browser compatibility for the :has() selector.

While consolidating styles is good for maintainability, the :has() selector is relatively new and might not be supported in all browsers.

Consider adding a fallback for browsers that don't support :has():

 .tiny-popconfirm-popover:has(.popper__arrow),
 .tiny-popper:has(.popper__arrow),
 .tiny-tooltip__popper:has(.popper__arrow) {
+  /* Fallback for browsers that don't support :has() */
+}
+
+/* Separate selectors as fallback */
+.tiny-popconfirm-popover .popper__arrow,
+.tiny-popper .popper__arrow,
+.tiny-tooltip__popper .popper__arrow {
   /* Same styles as above */
 }
✅ Verification successful

Browser compatibility concerns with :has() are valid, but the implementation is acceptable

The usage of :has() selector is part of a progressive enhancement strategy:

  • The styles only affect the visual appearance of popper arrows (tooltips, popconfirms)
  • The base functionality remains intact even without :has() support
  • The component will still work, just with slightly different spacing/appearance
  • Modern enterprise browsers (Chrome, Edge, Safari) support :has()

The codebase shows a pattern of handling compatibility issues where needed (e.g., @supports for MS Edge), suggesting browser support is considered when critical.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if there are any browser compatibility fallbacks in the codebase

# Test: Look for any CSS fallback patterns or polyfills for :has()
rg -i "has\(\)" "packages/theme" -A 5 -B 5

Length of output: 42


Script:

#!/bin/bash
# Let's check the entire reset.less file to understand the context better
cat packages/theme/src/base/reset.less

# Also check for any browser compatibility related configurations or comments
rg -i "browser|compat|support" packages/theme

Length of output: 4533


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the bug Something isn't working label Nov 8, 2024
Copy link

github-actions bot commented Nov 8, 2024

[e2e-test-warn]
The component to be tested is missing.

The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug".

Please make sure you've read our contributing guide

Copy link

@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.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
examples/sites/src/views/components/components.vue (1)

Typo found in scroll container ID: 'doc-layout-scoller' should be 'doc-layout-scroller'

The ID doc-layout-scoller appears to be misspelled (missing 'r') and is used consistently but incorrectly throughout the components.vue file. This typo appears in:

  • HTML element definition: <div class="docs-content" id="doc-layout-scoller">
  • Container ID prop: container-id="#doc-layout-scoller"
  • Multiple getElementById calls
  • Comments

While the code works because the ID is consistently misspelled everywhere it's used, it should be corrected to doc-layout-scroller for better maintainability and clarity.

🔗 Analysis chain

Line range hint 476-494: LGTM: Scroll handling changes align with PR objective

The modifications to scroll handling functions correctly implement the new scrolling container, which should fix the Popper layers separation issue during document scrolling. However, remember to update the ID references after fixing the typo.

Let's verify all occurrences of the ID are updated:

Also applies to: 504-509, 625-630, 636-639, 644-647

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all occurrences of the ID to ensure consistent updates
rg "doc-layout-scoller" --type vue

Length of output: 62


Script:

#!/bin/bash
# Search for the ID pattern without file type restriction since .vue files might not be recognized
rg "doc-layout-scoller"

Length of output: 1096


Script:

#!/bin/bash
# Use find and grep as a fallback to search for the pattern
find . -type f -exec grep -l "doc-layout-scoller" {} \;

Length of output: 111


Script:

#!/bin/bash
# Search for similar ID patterns to check if there might be a typo
rg "doc-layout-scoll" 
rg "doc-layout-scroll"

Length of output: 1117

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 8eb46c5 and 608167c.

📒 Files selected for processing (2)
  • examples/sites/src/views/components/components.vue (8 hunks)
  • examples/sites/src/views/layout/layout.vue (0 hunks)
💤 Files with no reviewable changes (1)
  • examples/sites/src/views/layout/layout.vue
🔇 Additional comments (1)
examples/sites/src/views/components/components.vue (1)

812-814: LGTM: Appropriate overflow handling for scroll container

The overflow properties are correctly set to enable vertical scrolling while preventing horizontal overflow. The transition property ensures smooth visual changes.

@@ -16,7 +16,7 @@
</div>
<span class="docs-header-spacer"></span>
</header>
<div class="docs-content">
<div class="docs-content" id="doc-layout-scoller">
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix typo in ID: doc-layout-scoller should be doc-layout-scroller

The ID has a typo: "scoller" should be "scroller". This needs to be fixed consistently throughout the file to maintain clarity and prevent future maintenance issues.

-  <div class="docs-content" id="doc-layout-scoller">
+  <div class="docs-content" id="doc-layout-scroller">

-            container-id="#doc-layout-scoller"
+            container-id="#doc-layout-scroller"

Also applies to: 244-244

@zzcr zzcr merged commit 1a8cd6f into opentiny:release-3.19.0 Nov 8, 2024
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Nov 10, 2024
13 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 3, 2024
13 tasks
@shenjunjian shenjunjian deleted the release319-site-scrollbug branch January 9, 2025 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants