@@ -77,7 +77,7 @@ import PfCloseButton from '../CloseButton.vue';
7777import PfAlertIcon , { AlertVariantIcons } from ' ./AlertIcon.vue' ;
7878import PfAngleRightIcon from ' @vue-patternfly/icons/angle-right-icon' ;
7979import { useOUIAProps , type OUIAProps } from ' ../../helpers/ouia' ;
80- import { ref , watch , type Ref , type HTMLAttributes , onBeforeUnmount , onMounted , computed , type Component } from ' vue' ;
80+ import { ref , watch , type HTMLAttributes , onBeforeUnmount , onMounted , computed , type Component , useTemplateRef , type ComponentPublicInstance } from ' vue' ;
8181import { useElementSize } from ' @vueuse/core' ;
8282import { useManagedProp } from ' ../../use' ;
8383import type { Placement } from ' ../../helpers/FloatingUi.vue' ;
@@ -149,7 +149,7 @@ defineSlots<{
149149 ' action-links' ? : (props ? : Record <never , never >) => any ;
150150}>();
151151
152- const titleRef: Ref <HTMLElement | undefined > = ref ( );
152+ const titleRef = useTemplateRef <HTMLElement | ComponentPublicInstance >( ' titleRef ' );
153153const { width, height } = useElementSize (titleRef );
154154const tooltipVisible = ref (false );
155155let timer: number | undefined = undefined ;
@@ -158,15 +158,15 @@ const isMouseOver = ref(false);
158158const timedOut = ref (false );
159159const timedOutAnimation = ref (true );
160160const containsFocus = ref (false );
161- const el: Ref < HTMLDivElement | null > = ref ( null );
161+ const el = useTemplateRef ( ' el ' );
162162
163163const managedExpanded = useManagedProp (' expanded' , false );
164164const variantLabel = computed (() => ` ${props .variant .charAt (0 ).toUpperCase ()}${props .variant .slice (1 )} alert: ` );
165165const dismissed = computed (() => timedOut .value && timedOutAnimation .value && ! isMouseOver .value && ! containsFocus .value );
166166
167167
168168watch (() => [width .value , height .value ], () => {
169- if (! titleRef .value || ! props .truncateTitle ) {
169+ if (! ( titleRef .value instanceof HTMLElement ) || ! props .truncateTitle ) {
170170 return false ;
171171 }
172172 tooltipVisible .value = titleRef .value .offsetHeight < titleRef .value .scrollHeight ;
0 commit comments