Skip to content

feat: enhance DropdownMenu with hover trigger support#127

Merged
gene9831 merged 2 commits intoopentiny:release/v0.2.xfrom
gene9831:feat/dropdown-hover
Jun 27, 2025
Merged

feat: enhance DropdownMenu with hover trigger support#127
gene9831 merged 2 commits intoopentiny:release/v0.2.xfrom
gene9831:feat/dropdown-hover

Conversation

@gene9831
Copy link
Copy Markdown
Collaborator

@gene9831 gene9831 commented Jun 27, 2025

Summary by CodeRabbit

  • New Features

    • Added support for hover-triggered dropdown menus, allowing users to open dropdowns by hovering over the trigger element.
  • Documentation

    • Updated documentation to reflect the new hover trigger mode and clarified customization options for the dropdown menu component.
  • Refactor

    • Improved dropdown menu styling flexibility using CSS variables and enhanced transition effects.
  • Style

    • Updated visual styles for dropdown menus, including hover backgrounds and removal of certain font weights.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 27, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes introduce a "hover" trigger mode to the dropdown menu component, update its demo and documentation to reflect the new behavior, and refactor the component's logic and styling to support hover interactions and CSS variable-based customization. Type definitions and event handling were also adjusted for improved flexibility.

Changes

File(s) Change Summary
docs/demos/dropdown-menu/basic.vue Added a new demo section with two horizontally arranged dropdowns using the hover trigger and logging clicks.
docs/src/components/dropdown-menu.md Updated documentation: added 'hover' to trigger prop, removed minWidth/topOffset, clarified slots/events.
packages/components/src/base-popper/index.vue Made TriggerEvents type properties optional by changing from Record to Partial<Record>.
packages/components/src/dropdown-menu/index.type.ts Extended trigger prop to include 'hover', removed minWidth, added click-outside event to emits interface.
packages/components/src/dropdown-menu/index.vue Refactored trigger logic to support 'hover', updated event handling, styling via CSS variables, and transitions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DropdownMenu
    participant Console

    User->>DropdownMenu: Hover over trigger (trigger="hover")
    DropdownMenu->>DropdownMenu: Detect hover (with delay)
    DropdownMenu->>DropdownMenu: Show dropdown menu
    User->>DropdownMenu: Move cursor away (trigger="hover")
    DropdownMenu->>DropdownMenu: Detect hover leave (with delay)
    DropdownMenu->>DropdownMenu: Hide dropdown menu
    User->>DropdownMenu: Click menu item
    DropdownMenu->>Console: Log clicked item
Loading

Poem

A dropdown now floats on a hover so light,
With menus that open in gentle delight.
CSS variables dance, transitions anew,
Docs and types polished with clarity too.
Rabbits rejoice—such features we favor,
For menus that open with elegant flavor!
🐇✨

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this 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.

- Added support for 'hover' trigger in the DropdownMenu component, allowing menus to display on hover events.
- Updated documentation to reflect the new trigger options and their descriptions.
- Refactored event handling to manage hover states and click events more effectively.
- Improved styling variables for better customization of dropdown appearance.
@gene9831 gene9831 force-pushed the feat/dropdown-hover branch from 087392c to 6a13d92 Compare June 27, 2025 02:37
@gene9831 gene9831 changed the title Feat/dropdown hover feat: enhance DropdownMenu with hover trigger support Jun 27, 2025
@gene9831 gene9831 marked this pull request as ready for review June 27, 2025 02:41
@gene9831
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 27, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gene9831 gene9831 merged commit c19738b into opentiny:release/v0.2.x Jun 27, 2025
@gene9831 gene9831 deleted the feat/dropdown-hover branch June 27, 2025 07:49
gene9831 added a commit to gene9831/tiny-robot that referenced this pull request Jul 3, 2025
* feat: enhance DropdownMenu with hover trigger support

- Added support for 'hover' trigger in the DropdownMenu component, allowing menus to display on hover events.
- Updated documentation to reflect the new trigger options and their descriptions.
- Refactored event handling to manage hover states and click events more effectively.
- Improved styling variables for better customization of dropdown appearance.

* feat: add TODO for safePolygon implementation in DropdownMenu hover trigger
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