-
Notifications
You must be signed in to change notification settings - Fork 324
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -288,7 +288,10 @@ export const wheelListener = ({ vm, api, tabs, state }) => | |
|
||
export const getBoundRect = (vm) => () => vm.$el.getBoundingClientRect() | ||
|
||
export const handleClickDropdownItem = (tabs) => (name) => tabs.clickMore(name) | ||
export const handleClickDropdownItem = (tabs) => (navItem, event) => { | ||
tabs.$emit('click', navItem, event) | ||
tabs.clickMore(navItem.name) | ||
} | ||
Comment on lines
+291
to
+294
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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
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
|
||
|
||
export const scrollToLeft = (tabs) => () => { | ||
tabs.scrollTo(tabs.state.navs[0].name) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ export default defineComponent({ | |
state.moreList.length | ||
? h('div', { class: 'hidden sm:inline-block w-11 h-11 sm:h-10 text-sm cursor-pointer' }, [ | ||
h('span', { class: 'inline-flex w-full h-full flex-col justify-center items-center' }, [ | ||
h(Dropdown, { on: { 'item-click': handleClickDropdownItem }, props: { showIcon: false } }, [ | ||
h(Dropdown, { props: { showIcon: false } }, [ | ||
h('span', {}, [h(IconPopup(), { class: 'fill-color-icon-focus text-base' })]), | ||
h( | ||
DropdownMenu, | ||
|
@@ -90,9 +90,11 @@ export default defineComponent({ | |
props: { popperClass: 'max-h-[theme(spacing.80)] overflow-x-hidden overflow-y-auto' } | ||
}, | ||
state.moreOptions.map((opt: NavItem) => | ||
h(DropdownItem, { key: key(opt), props: { itemData: opt.name } }, [ | ||
opt.slotTitle ? opt.slotTitle() : opt.title | ||
]) | ||
h( | ||
DropdownItem, | ||
{ key: key(opt), on: { click: handleClickDropdownItem }, props: { itemData: opt } }, | ||
[opt.slotTitle ? opt.slotTitle() : opt.title] | ||
) | ||
Comment on lines
+93
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pass disabled state and use stable keys
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
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
|
||
) | ||
) | ||
]) | ||
|