From 10c7e65e536a0bf700aa2575c7b9b70363c37ed5 Mon Sep 17 00:00:00 2001 From: Antony Date: Tue, 3 Dec 2024 19:27:17 -0300 Subject: [PATCH 1/2] fix(TooltipTrigger): open tooltip on touch devices --- packages/radix-vue/src/Tooltip/TooltipTrigger.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/radix-vue/src/Tooltip/TooltipTrigger.vue b/packages/radix-vue/src/Tooltip/TooltipTrigger.vue index 402ce91da..359b08039 100644 --- a/packages/radix-vue/src/Tooltip/TooltipTrigger.vue +++ b/packages/radix-vue/src/Tooltip/TooltipTrigger.vue @@ -53,7 +53,7 @@ onMounted(() => { function handlePointerUp() { setTimeout(() => { isPointerDown.value = false - }, 1) + }, 100) } function handlePointerDown() { @@ -64,6 +64,7 @@ function handlePointerDown() { function handlePointerMove(event: PointerEvent) { if (event.pointerType === 'touch') return + if ( !hasPointerMoveOpened.value && !providerContext.isPointerInTransitRef.value ) { @@ -72,7 +73,10 @@ function handlePointerMove(event: PointerEvent) { } } -function handlePointerLeave() { +function handlePointerLeave(event: PointerEvent) { + if (event.pointerType === 'touch') + return + rootContext.onTriggerLeave() hasPointerMoveOpened.value = false } @@ -92,6 +96,9 @@ function handleBlur() { } function handleClick() { + if (isPointerDown.value) + return rootContext.onOpen() + if (!rootContext.disableClosingTrigger.value) rootContext.onClose() } From 16b78de59636ed48e946a50830be6d950fa657df Mon Sep 17 00:00:00 2001 From: Antony Date: Tue, 3 Dec 2024 21:20:42 -0300 Subject: [PATCH 2/2] chore(TooltipTrigger): isPointerDown exclusive for touch devices --- packages/radix-vue/src/Tooltip/TooltipTrigger.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/radix-vue/src/Tooltip/TooltipTrigger.vue b/packages/radix-vue/src/Tooltip/TooltipTrigger.vue index 359b08039..459c7365b 100644 --- a/packages/radix-vue/src/Tooltip/TooltipTrigger.vue +++ b/packages/radix-vue/src/Tooltip/TooltipTrigger.vue @@ -56,7 +56,10 @@ function handlePointerUp() { }, 100) } -function handlePointerDown() { +function handlePointerDown(e: PointerEvent) { + if (e.pointerType === 'mouse') + return + isPointerDown.value = true document.addEventListener('pointerup', handlePointerUp, { once: true }) }