mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-01 22:10:23 +00:00
fix: prevent tooltip reopen on trigger click (#22571)
This commit is contained in:
parent
c48a4cc05b
commit
8d89c3417b
1 changed files with 12 additions and 0 deletions
|
|
@ -99,6 +99,8 @@ export function Tooltip(props: TooltipProps) {
|
|||
onCleanup(() => obs.disconnect())
|
||||
})
|
||||
|
||||
let justClickedTrigger = false
|
||||
|
||||
return (
|
||||
<Switch>
|
||||
<Match when={local.inactive}>{local.children}</Match>
|
||||
|
|
@ -112,6 +114,10 @@ export function Tooltip(props: TooltipProps) {
|
|||
onOpenChange={(open) => {
|
||||
if (local.forceOpen) return
|
||||
if (state.block && open) return
|
||||
if (justClickedTrigger) {
|
||||
justClickedTrigger = false
|
||||
return
|
||||
}
|
||||
setState("open", open)
|
||||
}}
|
||||
>
|
||||
|
|
@ -137,6 +143,12 @@ export function Tooltip(props: TooltipProps) {
|
|||
data-force-open={local.forceOpen}
|
||||
class={local.contentClass}
|
||||
style={local.contentStyle}
|
||||
onPointerDownOutside={(e) => {
|
||||
if (ref === e.target || (e.target instanceof Node && ref?.contains(e.target))) {
|
||||
justClickedTrigger = true
|
||||
}
|
||||
e.preventDefault()
|
||||
}}
|
||||
>
|
||||
{local.value}
|
||||
{/* <KobalteTooltip.Arrow data-slot="tooltip-arrow" /> */}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue