Skip to content

Commit 90133b4

Browse files
committed
fix(CDropdownMenu, CPopover, CTooltip): add inheritAttrs: false to resolve the inheritance issue
1 parent c187d0b commit 90133b4

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

packages/coreui-vue/src/components/dropdown/CDropdownMenu.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { getAlignmentClassNames } from './utils'
55

66
const CDropdownMenu = defineComponent({
77
name: 'CDropdownMenu',
8+
inheritAttrs: false,
89
props: {
910
/**
1011
* Component used for the root node. Either a string to use a HTML element or a component.
@@ -16,7 +17,7 @@ const CDropdownMenu = defineComponent({
1617
default: 'div',
1718
},
1819
},
19-
setup(props, { slots }) {
20+
setup(props, { attrs, slots }) {
2021
const dropdownMenuRef = inject('dropdownMenuRef') as Ref<HTMLElement>
2122
const config = inject('config') as any // eslint-disable-line @typescript-eslint/no-explicit-any
2223
const visible = inject('visible') as Ref<boolean>
@@ -35,10 +36,12 @@ const CDropdownMenu = defineComponent({
3536
h(
3637
props.component,
3738
{
39+
...attrs,
3840
class: [
3941
'dropdown-menu',
4042
{ show: visible.value },
4143
getAlignmentClassNames(alignment),
44+
attrs.class,
4245
],
4346
...((typeof alignment === 'object' || !popper) && {
4447
'data-coreui-popper': 'static',

packages/coreui-vue/src/components/popover/CPopover.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { getRTLPlacement } from '../../utils'
99

1010
const CPopover = defineComponent({
1111
name: 'CPopover',
12+
inheritAttrs: false,
1213
props: {
1314
/**
1415
* Apply a CSS fade transition to the popover.
@@ -25,9 +26,7 @@ const CPopover = defineComponent({
2526
* @since v5.0.0-beta.0
2627
*/
2728
container: {
28-
type: [Object, String] as PropType<
29-
HTMLElement | (() => HTMLElement) | string
30-
>,
29+
type: [Object, String] as PropType<HTMLElement | (() => HTMLElement) | string>,
3130
default: 'body',
3231
},
3332
/**
@@ -198,16 +197,17 @@ const CPopover = defineComponent({
198197
h(
199198
'div',
200199
{
200+
...attrs,
201201
class: [
202202
'popover',
203203
'bs-popover-auto',
204204
{
205205
fade: props.animation,
206206
},
207+
attrs.class,
207208
],
208209
ref: popoverRef,
209210
role: 'tooltip',
210-
...attrs,
211211
},
212212
[
213213
h('div', { class: 'popover-arrow' }),

packages/coreui-vue/src/components/tooltip/CTooltip.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { getRTLPlacement } from '../../utils'
99

1010
const CTooltip = defineComponent({
1111
name: 'CTooltip',
12+
// inheritAttrs: false,
1213
props: {
1314
/**
1415
* Apply a CSS fade transition to the tooltip.
@@ -194,16 +195,17 @@ const CTooltip = defineComponent({
194195
h(
195196
'div',
196197
{
198+
...attrs,
197199
class: [
198200
'tooltip',
199201
'bs-tooltip-auto',
200202
{
201203
fade: props.animation,
202204
},
205+
attrs.class,
203206
],
204207
ref: tooltipRef,
205208
role: 'tooltip',
206-
...attrs,
207209
},
208210
[
209211
h('div', { class: 'tooltip-arrow' }),

0 commit comments

Comments
 (0)