@arbidocs/react 0.4.45 → 0.4.47

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.
@@ -1545,6 +1545,12 @@ var PopoverContent = React__namespace.forwardRef(({ className, align = "center",
1545
1545
  PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
1546
1546
  var FINE_OPEN_DELAY = 350;
1547
1547
  var FINE_CLOSE_DELAY = 180;
1548
+ var silentFocusMarks = /* @__PURE__ */ new WeakSet();
1549
+ function returnFocusToMark(mark) {
1550
+ silentFocusMarks.add(mark);
1551
+ mark.focus({ preventScroll: true });
1552
+ silentFocusMarks.delete(mark);
1553
+ }
1548
1554
  function isFocusVisible(el) {
1549
1555
  try {
1550
1556
  return el.matches(":focus-visible");
@@ -1624,7 +1630,7 @@ function MarkMenu({
1624
1630
  const close = (returnFocus = false) => {
1625
1631
  clearTimer();
1626
1632
  setOpen(false);
1627
- if (returnFocus) triggerRef.current?.focus({ preventScroll: true });
1633
+ if (returnFocus && triggerRef.current) returnFocusToMark(triggerRef.current);
1628
1634
  };
1629
1635
  const schedule = (action, delay) => {
1630
1636
  clearTimer();
@@ -1656,7 +1662,7 @@ function MarkMenu({
1656
1662
  };
1657
1663
  const handleFocus = (e) => {
1658
1664
  onFocus?.(e);
1659
- if (isEmpty) return;
1665
+ if (isEmpty || silentFocusMarks.has(e.currentTarget)) return;
1660
1666
  if (isFocusVisible(e.currentTarget)) schedule(() => openWith("focus"), openDelay);
1661
1667
  };
1662
1668
  const handleBlur = (e) => {
@@ -4193,7 +4199,8 @@ exports.getStatusVariant = getStatusVariant;
4193
4199
  exports.getTagTypeIcon = getTagTypeIcon;
4194
4200
  exports.getTagTypeLabel = getTagTypeLabel;
4195
4201
  exports.getWorkspaceColor = getWorkspaceColor;
4202
+ exports.returnFocusToMark = returnFocusToMark;
4196
4203
  exports.toggleVariants = toggleVariants;
4197
4204
  exports.useAudioRecorder = useAudioRecorder;
4198
- //# sourceMappingURL=chunk-XKXN2EDC.cjs.map
4199
- //# sourceMappingURL=chunk-XKXN2EDC.cjs.map
4205
+ //# sourceMappingURL=chunk-ATX7FAO6.cjs.map
4206
+ //# sourceMappingURL=chunk-ATX7FAO6.cjs.map