@ai-matrx/design-system 0.86.358 → 0.86.359

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.
@@ -1867,6 +1867,7 @@ function SwipeDeck(props) {
1867
1867
  };
1868
1868
  }, []);
1869
1869
  const rootRef = React6.useRef(null);
1870
+ const answeredHere = React6.useRef(false);
1870
1871
  const frameRef = React6.useRef(null);
1871
1872
  const layerRef = React6.useRef(null);
1872
1873
  const edgeRefs = React6.useRef({});
@@ -1935,6 +1936,7 @@ function SwipeDeck(props) {
1935
1936
  enterFrom.current = null;
1936
1937
  setCardDetail(null);
1937
1938
  setLocked(null);
1939
+ answeredHere.current = true;
1938
1940
  controller.commit(change);
1939
1941
  busy.current = false;
1940
1942
  setHot(edgeRefs.current, null);
@@ -2165,11 +2167,18 @@ function SwipeDeck(props) {
2165
2167
  }, [keyboard, layout]);
2166
2168
  const cardId = cardItem?.id ?? null;
2167
2169
  React6.useEffect(() => {
2170
+ const fromAnswer = answeredHere.current;
2171
+ answeredHere.current = false;
2168
2172
  if (!keyboard || layout === "inline" || cardId === null) return;
2169
2173
  const root = rootRef.current;
2170
- const active = root?.ownerDocument.activeElement;
2174
+ const doc = root?.ownerDocument;
2175
+ const active = doc?.activeElement ?? null;
2171
2176
  if (!root || active && root.contains(active)) return;
2172
- if (active?.closest("input, textarea, select, [contenteditable='true'], [role='dialog'], [role='alertdialog'], [role='menu'], [role='listbox']")) return;
2177
+ const idle = !active || active === doc?.body || active === doc?.documentElement;
2178
+ if (!idle && !fromAnswer) return;
2179
+ if (active?.closest("input, textarea, select, [contenteditable]:not([contenteditable='false']), [role='combobox'], [role='textbox'], [role='menu'], [role='listbox']")) return;
2180
+ const dialog = active?.closest("[role='dialog'], [role='alertdialog'], dialog");
2181
+ if (dialog && !dialog.contains(root)) return;
2173
2182
  root.focus({ preventScroll: true });
2174
2183
  }, [cardId, keyboard, layout]);
2175
2184
  const fingerRef = React6.useRef(null);