@@ -128,6 +128,9 @@ export interface MatTooltipDefaultOptions {
128
128
/** Default delay when hiding the tooltip on a touch device. */
129
129
touchendHideDelay : number ;
130
130
131
+ /** Time between the user putting the pointer on a tooltip trigger and the long press event being fired on a touch device. */
132
+ touchLongPressShowDelay ?: number ;
133
+
131
134
/** Default touch gesture handling for tooltips. */
132
135
touchGestures ?: TooltipTouchGestures ;
133
136
@@ -156,12 +159,6 @@ const PANEL_CLASS = 'tooltip-panel';
156
159
/** Options used to bind passive event listeners. */
157
160
const passiveListenerOptions = normalizePassiveListenerOptions ( { passive : true } ) ;
158
161
159
- /**
160
- * Time between the user putting the pointer on a tooltip
161
- * trigger and the long press event being fired.
162
- */
163
- const LONGPRESS_DELAY = 500 ;
164
-
165
162
// These constants were taken from MDC's `numbers` object. We can't import them from MDC,
166
163
// because they have some top-level references to `window` which break during SSR.
167
164
const MIN_VIEWPORT_TOOLTIP_THRESHOLD = 8 ;
@@ -787,7 +784,12 @@ export class MatTooltip implements OnDestroy, AfterViewInit {
787
784
// because it can prevent click events from firing on the element.
788
785
this . _setupPointerExitEventsIfNeeded ( ) ;
789
786
clearTimeout ( this . _touchstartTimeout ) ;
790
- this . _touchstartTimeout = setTimeout ( ( ) => this . show ( undefined , origin ) , LONGPRESS_DELAY ) ;
787
+
788
+ const DEFAULT_LONGPRESS_DELAY = 500 ;
789
+ this . _touchstartTimeout = setTimeout (
790
+ ( ) => this . show ( undefined , origin ) ,
791
+ this . _defaultOptions . touchLongPressShowDelay ?? DEFAULT_LONGPRESS_DELAY ,
792
+ ) ;
791
793
} ,
792
794
] ) ;
793
795
}
0 commit comments