@seed-design/stackflow 2.0.3 → 2.0.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.
@@ -22,6 +22,8 @@ function useSwipeBack(props) {
22
22
  edgeProps: {
23
23
  tabIndex: -1,
24
24
  onTouchStart: (e) => {
25
+ const activeElement = e.currentTarget.ownerDocument.activeElement;
26
+ if (activeElement && "blur" in activeElement && typeof activeElement.blur === "function") activeElement.blur();
25
27
  const x0 = e.touches[0].clientX;
26
28
  startSwipeBack({
27
29
  x0,
@@ -21,6 +21,8 @@ function useSwipeBack(props) {
21
21
  edgeProps: {
22
22
  tabIndex: -1,
23
23
  onTouchStart: (e) => {
24
+ const activeElement = e.currentTarget.ownerDocument.activeElement;
25
+ if (activeElement && "blur" in activeElement && typeof activeElement.blur === "function") activeElement.blur();
24
26
  const x0 = e.touches[0].clientX;
25
27
  startSwipeBack({
26
28
  x0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-design/stackflow",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/daangn/seed-design.git",
@@ -40,7 +40,7 @@
40
40
  "clsx": "^2.1.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@seed-design/css": "2.3.0",
43
+ "@seed-design/css": "2.8.0",
44
44
  "@stackflow/core": "^1.2.0",
45
45
  "@stackflow/react": "^1.5.1",
46
46
  "@types/react": "^19.2.2",
@@ -50,6 +50,15 @@ export function useSwipeBack(props: UseSwipeBackProps) {
50
50
  edgeProps: {
51
51
  tabIndex: -1,
52
52
  onTouchStart: (e: React.TouchEvent) => {
53
+ // Dismiss input focus before moving the screen, even if the swipe is cancelled.
54
+ const activeElement = e.currentTarget.ownerDocument.activeElement;
55
+ if (
56
+ activeElement &&
57
+ "blur" in activeElement &&
58
+ typeof activeElement.blur === "function"
59
+ ) {
60
+ activeElement.blur();
61
+ }
53
62
  const x0 = e.touches[0].clientX;
54
63
  const t0 = Date.now();
55
64
  startSwipeBack({ x0, t0 });