Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(tabs): Fix the issue where multiple clicks on mobile-first tabs do not take effect #3669

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

Merged
zzcr merged 2 commits into dev from fix/tabs-20250828
Aug 29, 2025

Conversation

Copy link
Collaborator

@chenxi-20 chenxi-20 commented Aug 28, 2025
edited by coderabbitai bot
Loading

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

Summary by CodeRabbit

  • New Features

    • Dropdown items (standard and mobile-first) now emit a click event that includes the item's data and the original click event.
    • Tabs "More" menu items emit click events with full item data before performing navigation.
  • Refactor

    • Tab bar moved from wrapper-level item-click handling to per-item click handlers, passing full option objects for more consistent event payloads.

@chenxi-20 chenxi-20 added the bug Something isn't working label Aug 28, 2025
Copy link

coderabbitai bot commented Aug 28, 2025
edited
Loading

Walkthrough

Adds a public "click" event emission from dropdown-item carrying (itemData, MouseEvent); updates renderless tabs handler to (navItem, event), emit that click, then call clickMore(navItem.name); updates Tab Bar to bind per-item click handlers and pass full option objects as itemData.

Changes

Cohort / File(s) Summary of changes
Dropdown-item: emit click event
packages/design/aurora/src/dropdown-item/index.ts, packages/vue/src/dropdown-item/src/mobile-first.vue
Emits a new public click event with payload (itemData, event) in both dataStore and non-dataStore paths; Vue component lists click in its emits.
Tabs renderless: handler signature and emission
packages/renderless/src/tabs-mf/index.ts
handleClickDropdownItem signature changed to (navItem, event); it now calls tabs.$emit('click', navItem, event) then tabs.clickMore(navItem.name).
Tabs UI wiring: per-item click and payload
packages/vue/src/tabs/src/mobile-first/tab-bar.vue
Removed wrapper item-click binding; each DropdownItem receives on: { click: handleClickDropdownItem }. itemData changed from opt.name to the full opt object.

Sequence Diagram(s)

sequenceDiagram
 autonumber
 actor U as User
 participant TB as Tab Bar (mobile-first)
 participant DI as DropdownItem
 participant TR as Tabs Renderless
 U->>DI: click(item)
 DI-->>TB: emit "click"(itemData, event)
 TB->>TR: handleClickDropdownItem(itemData, event)
 TR-->>TB: $emit "click"(navItem, event)
 TR->>TR: clickMore(navItem.name)
 note right of TR: navigation triggered by name
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A rabbit taps a menu bright,
Sends item-data into the night.
A tiny click, an event in flight,
Tabs hop on, name-led and light.
I munch a carrot — code feels right. 🥕

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9d14511 and b4aa118.

📒 Files selected for processing (1)
  • packages/design/aurora/src/dropdown-item/index.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/design/aurora/src/dropdown-item/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/tabs-20250828

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.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit 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:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

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: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between add4348 and 9d14511.

📒 Files selected for processing (4)
  • packages/design/aurora/src/dropdown-item/index.ts (2 hunks)
  • packages/renderless/src/tabs-mf/index.ts (1 hunks)
  • packages/vue/src/dropdown-item/src/mobile-first.vue (1 hunks)
  • packages/vue/src/tabs/src/mobile-first/tab-bar.vue (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (3)
packages/vue/src/dropdown-item/src/mobile-first.vue (1)

43-43: Add 'click' to emits — OK; ensure types/docs updated

Good addition to avoid Vue warns. Please also update any TS declaration (if applicable) and component docs to include the new "click(itemData, event)" payload.

packages/vue/src/tabs/src/mobile-first/tab-bar.vue (2)

84-101: Delegating per-item click to DropdownItem — LGTM

This matches the new DropdownItem "click" event and should resolve the multi-click issue.


84-101: No lingering item-click listeners in tab-bar.vue; removal is safe.

Comment on lines 40 to 41
emit('click', dataStore.itemData, event)

Copy link

@coderabbitai coderabbitai bot Aug 28, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Do not emit "click" for disabled items

Currently "click" fires even when props.disabled is true, which can trigger navigation from disabled entries. Guard both branches.

Apply this diff:

@@
- emit('click', dataStore.itemData, event)
+ if (!props.disabled) {
+ emit('click', dataStore.itemData, event)
+ }
@@
- emit('click', props.itemData, event)
+ if (!props.disabled) {
+ emit('click', props.itemData, event)
+ }

Also applies to: 51-51

🤖 Prompt for AI Agents
In packages/design/aurora/src/dropdown-item/index.ts around lines 40-41 (and
also line 51), the component currently emits 'click' even when props.disabled is
true; update both places so that if props.disabled is truthy the handler returns
early or skips emitting—i.e., add a guard like if (props.disabled) return or
wrap emit calls in if (!props.disabled) { emit('click', dataStore.itemData,
event) } to prevent navigation/actions from disabled items.

Comment on lines +291 to +294
export const handleClickDropdownItem = (tabs) => (navItem, event) => {
tabs.$emit('click', navItem, event)
tabs.clickMore(navItem.name)
}
Copy link

@coderabbitai coderabbitai bot Aug 28, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Align behavior with tab-nav clicks; validate input and skip disabled

Keep event order consistent with handleNavItemClick (emit after activation), and avoid acting on invalid/disabled items.

Apply this diff:

-export const handleClickDropdownItem = (tabs) => (navItem, event) => {
- tabs.$emit('click', navItem, event)
- tabs.clickMore(navItem.name)
-}
+export const handleClickDropdownItem = (tabs) => (navItem, event) => {
+ if (!navItem || !navItem.name || navItem.disabled) return
+ tabs.clickMore(navItem.name)
+ tabs.$emit('click', navItem, event)
+}
📝 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.

Suggested change
export const handleClickDropdownItem = (tabs) => (navItem, event) => {
tabs.$emit('click', navItem, event)
tabs.clickMore(navItem.name)
}
export const handleClickDropdownItem = (tabs) => (navItem, event) => {
if (!navItem || !navItem.name || navItem.disabled) return
tabs.clickMore(navItem.name)
tabs.$emit('click', navItem, event)
}
🤖 Prompt for AI Agents
In packages/renderless/src/tabs-mf/index.ts around lines 291 to 294, the
dropdown click handler currently emits before activation and doesn't validate
input or skip disabled items; update handleClickDropdownItem to first check that
navItem exists and is not disabled (and has a valid name), then call
tabs.clickMore(navItem.name) to activate the tab, and only after successful
activation call tabs.$emit('click', navItem, event); return early if validation
fails to avoid acting on invalid/disabled items.

Comment on lines +93 to +97
h(
DropdownItem,
{ key: key(opt), on: { click: handleClickDropdownItem }, props: { itemData: opt } },
[opt.slotTitle ? opt.slotTitle() : opt.title]
)
Copy link

@coderabbitai coderabbitai bot Aug 28, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Pass disabled state and use stable keys

  • Without passing disabled, disabled items won’t render/behave correctly.
  • Randomized keys cause unnecessary remounts. Use a stable key (e.g., name).

Apply this diff:

- h(
- DropdownItem,
- { key: key(opt), on: { click: handleClickDropdownItem }, props: { itemData: opt } },
- [opt.slotTitle ? opt.slotTitle() : opt.title]
- )
+ h(
+ DropdownItem,
+ {
+ key: opt.name,
+ on: { click: handleClickDropdownItem },
+ props: { itemData: opt, disabled: !!opt.disabled }
+ },
+ [opt.slotTitle ? opt.slotTitle() : opt.title]
+ )
📝 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.

Suggested change
h(
DropdownItem,
{ key: key(opt), on: { click: handleClickDropdownItem }, props: { itemData: opt } },
[opt.slotTitle ? opt.slotTitle() : opt.title]
)
h(
DropdownItem,
{
key: opt.name,
on: { click: handleClickDropdownItem },
props: { itemData: opt, disabled: !!opt.disabled }
},
[opt.slotTitle ? opt.slotTitle() : opt.title]
)
🤖 Prompt for AI Agents
packages/vue/src/tabs/src/mobile-first/tab-bar.vue around lines 93 to 97: the
DropdownItem is not receiving the disabled state and is using an unstable key
which causes unnecessary remounts; update the element to pass the disabled flag
from the option (e.g., props: { itemData: opt, disabled: opt.disabled }) and
replace the randomized key with a stable unique identifier from the option
(e.g., key: opt.name or opt.value), ensuring click handlers respect the disabled
state if needed.

@zzcr zzcr merged commit 8793c4a into dev Aug 29, 2025
9 of 10 checks passed
@zzcr zzcr deleted the fix/tabs-20250828 branch August 29, 2025 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

@zzcr zzcr zzcr approved these changes

Assignees
No one assigned
Labels
bug Something isn't working
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /