File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments