@@ -3,6 +3,7 @@ import { Component, Element, Event, Host, Prop, State, Watch, h } from '@stencil
33import { renderHiddenInput , inheritAriaAttributes } from '@utils/helpers' ;
44import type { Attributes } from '@utils/helpers' ;
55import { hapticSelection } from '@utils/native/haptic' ;
6+ import { isPlatform } from '@utils/platform' ;
67import { isRTL } from '@utils/rtl' ;
78import { createColorClasses , hostContext } from '@utils/theme' ;
89import { checkmarkOutline , removeOutline , ellipseOutline } from 'ionicons/icons' ;
@@ -247,6 +248,14 @@ export class Toggle implements ComponentInterface {
247248 }
248249
249250 private onClick = ( ev : MouseEvent ) => {
251+ /**
252+ * The haptics for the toggle is
253+ * an iOS-only feature when tapped.
254+ * As a result, it should be
255+ * disabled on Android.
256+ */
257+ const enableHaptics = isPlatform ( 'ios' ) ;
258+
250259 if ( this . disabled ) {
251260 return ;
252261 }
@@ -255,6 +264,7 @@ export class Toggle implements ComponentInterface {
255264
256265 if ( this . lastDrag + 300 < Date . now ( ) ) {
257266 this . toggleChecked ( ) ;
267+ enableHaptics && hapticSelection ( ) ;
258268 }
259269 } ;
260270
@@ -396,7 +406,6 @@ export class Toggle implements ComponentInterface {
396406 onBlur = { ( ) => this . onBlur ( ) }
397407 ref = { ( focusEl ) => ( this . focusEl = focusEl ) }
398408 required = { required }
399- { ...( { switch : true } as any ) }
400409 { ...this . inheritedAttributes }
401410 />
402411 < div
0 commit comments