Skip to content

Commit 5539d56

Browse files
committed
fix review fix
1 parent 1807e07 commit 5539d56

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

frontend/src/lib/utils/haptic.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ export function attachHapticToButton(
7171
duration = 20,
7272
): () => void {
7373
function handler() {
74+
// div ラッパーに attach した場合も含め、内包ボタンが disabled なら無視する
75+
const btn =
76+
button.tagName === "BUTTON"
77+
? (button as HTMLButtonElement)
78+
: button.querySelector("button");
79+
if (btn?.disabled) return;
7480
triggerHaptic(duration);
7581
}
7682
button.addEventListener("pointerdown", handler);

frontend/src/routes/settings/+page.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
import { enhance } from "$app/forms";
55
import { onMount } from "svelte";
66
import { attachHapticToButton } from "$lib/utils/haptic";
7+
import Modal from "$lib/components/molecules/Modal.svelte";
8+
import SettingsNav from "$lib/components/molecules/SettingsNav.svelte";
9+
import type { ActionData, PageData } from "./$types";
710
811
// Svelteアクション: ボタンに pointerdown で振動を付与する
912
function haptic(node: HTMLElement) {
1013
const detach = attachHapticToButton(node);
1114
return { destroy: detach };
1215
}
13-
import Modal from "$lib/components/molecules/Modal.svelte";
14-
import SettingsNav from "$lib/components/molecules/SettingsNav.svelte";
15-
import type { ActionData, PageData } from "./$types";
1616
1717
export let form: ActionData;
1818
export let data: PageData;

0 commit comments

Comments
 (0)