11<script lang="ts">
2- import type { VNode } from ' vue'
32import type { PopperContentProps } from ' @/Popper'
43import type { PrimitiveProps } from ' @/Primitive'
54import { useForwardExpose } from ' @/shared'
@@ -42,7 +41,7 @@ export interface TooltipContentImplProps
4241
4342<script setup lang="ts">
4443import { useEventListener } from ' @vueuse/core'
45- import { Comment , computed , onMounted , useSlots } from ' vue'
44+ import { computed , onMounted } from ' vue'
4645import { DismissableLayer } from ' @/DismissableLayer'
4746import { PopperContent } from ' @/Popper'
4847import { VisuallyHidden } from ' @/VisuallyHidden'
@@ -64,24 +63,8 @@ const emits = defineEmits<TooltipContentImplEmits>()
6463
6564const rootContext = injectTooltipRootContext ()
6665
67- const { forwardRef } = useForwardExpose ()
68- const slot = useSlots ()
69- const defaultSlot = computed (() => slot .default ?.({}))
70- const ariaLabel = computed (() => {
71- if (props .ariaLabel )
72- return props .ariaLabel
73- let content = ' '
74-
75- function recursiveTextSearch(node : VNode ) {
76- if (typeof node .children === ' string' && node .type !== Comment )
77- content += node .children
78- else if (Array .isArray (node .children ))
79- node .children .forEach (child => recursiveTextSearch (child as VNode ))
80- }
81-
82- defaultSlot .value ?.forEach ((node : VNode ) => recursiveTextSearch (node ))
83- return content
84- })
66+ const { forwardRef, currentElement } = useForwardExpose ()
67+ const ariaLabel = computed (() => props .ariaLabel || currentElement .value ?.textContent )
8568
8669const popperContentProps = computed (() => {
8770 const { ariaLabel : _, ... restProps } = props
0 commit comments