@@ -121,6 +121,9 @@ export interface MatTooltipDefaultOptions {
121
121
/** Default delay when hiding the tooltip on a touch device. */
122
122
touchendHideDelay : number ;
123
123
124
+ /** Time between the user putting the pointer on a tooltip trigger and the long press event being fired on a touch device. */
125
+ touchLongPressShowDelay ?: number ;
126
+
124
127
/** Default touch gesture handling for tooltips. */
125
128
touchGestures ?: TooltipTouchGestures ;
126
129
@@ -149,12 +152,6 @@ const PANEL_CLASS = 'tooltip-panel';
149
152
/** Options used to bind passive event listeners. */
150
153
const passiveListenerOptions = normalizePassiveListenerOptions ( { passive : true } ) ;
151
154
152
- /**
153
- * Time between the user putting the pointer on a tooltip
154
- * trigger and the long press event being fired.
155
- */
156
- const LONGPRESS_DELAY = 500 ;
157
-
158
155
// These constants were taken from MDC's `numbers` object. We can't import them from MDC,
159
156
// because they have some top-level references to `window` which break during SSR.
160
157
const MIN_VIEWPORT_TOOLTIP_THRESHOLD = 8 ;
@@ -751,7 +748,12 @@ export abstract class _MatTooltipBase<T extends _TooltipComponentBase>
751
748
// because it can prevent click events from firing on the element.
752
749
this . _setupPointerExitEventsIfNeeded ( ) ;
753
750
clearTimeout ( this . _touchstartTimeout ) ;
754
- this . _touchstartTimeout = setTimeout ( ( ) => this . show ( undefined , origin ) , LONGPRESS_DELAY ) ;
751
+
752
+ const DEFAULT_LONGPRESS_DELAY = 500 ;
753
+ this . _touchstartTimeout = setTimeout (
754
+ ( ) => this . show ( undefined , origin ) ,
755
+ this . _defaultOptions . touchLongPressShowDelay ?? DEFAULT_LONGPRESS_DELAY ,
756
+ ) ;
755
757
} ,
756
758
] ) ;
757
759
}
0 commit comments