bits-ui 2.15.3 → 2.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@ export declare class PopoverRootState {
19
19
  overlayPresence: PresenceManager;
20
20
  openedViaHover: boolean;
21
21
  hasInteractedWithContent: boolean;
22
+ hoverCooldown: boolean;
22
23
  closeDelay: number;
23
24
  constructor(opts: PopoverRootStateOpts);
24
25
  setDomContext(ctx: DOMContext): void;
@@ -24,6 +24,7 @@ export class PopoverRootState {
24
24
  // hover tracking state
25
25
  openedViaHover = $state(false);
26
26
  hasInteractedWithContent = $state(false);
27
+ hoverCooldown = $state(false);
27
28
  closeDelay = $state(0);
28
29
  #closeTimeout = null;
29
30
  #domContext = null;
@@ -159,7 +160,7 @@ export class PopoverTriggerState {
159
160
  this.#isHovering = true;
160
161
  this.#clearCloseTimeout();
161
162
  this.root.cancelDelayedClose();
162
- if (this.root.opts.open.current)
163
+ if (this.root.opts.open.current || this.root.hoverCooldown)
163
164
  return;
164
165
  const delay = this.opts.openDelay.current;
165
166
  if (delay <= 0) {
@@ -181,6 +182,7 @@ export class PopoverTriggerState {
181
182
  return;
182
183
  this.#isHovering = false;
183
184
  this.#clearOpenTimeout();
185
+ this.root.hoverCooldown = false;
184
186
  // let GraceArea handle the close - it will call handleHoverClose via onPointerExit
185
187
  // we just need to stop any pending open timer
186
188
  }
@@ -196,6 +198,15 @@ export class PopoverTriggerState {
196
198
  this.root.hasInteractedWithContent = true;
197
199
  return;
198
200
  }
201
+ // if closing while hovering with openOnHover enabled, set cooldown to prevent
202
+ // immediate re-open via hover
203
+ if (this.#isHovering && this.opts.openOnHover.current && this.root.opts.open.current) {
204
+ this.root.hoverCooldown = true;
205
+ }
206
+ // if clicking to open while in cooldown, reset cooldown (explicit open)
207
+ if (this.root.hoverCooldown && !this.root.opts.open.current) {
208
+ this.root.hoverCooldown = false;
209
+ }
199
210
  this.root.toggleOpen();
200
211
  }
201
212
  onkeydown(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "2.15.3",
3
+ "version": "2.15.4",
4
4
  "license": "MIT",
5
5
  "repository": "github:huntabyte/bits-ui",
6
6
  "funding": "https://github.com/sponsors/huntabyte",