source: trip-planner-front/node_modules/@angular/cdk/a11y/input-modality/input-modality-detector.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.8 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { InjectionToken, OnDestroy, NgZone } from '@angular/core';
9import { Platform } from '@angular/cdk/platform';
10import { Observable } from 'rxjs';
11/**
12 * The input modalities detected by this service. Null is used if the input modality is unknown.
13 */
14import * as ɵngcc0 from '@angular/core';
15export declare type InputModality = 'keyboard' | 'mouse' | 'touch' | null;
16/** Options to configure the behavior of the InputModalityDetector. */
17export interface InputModalityDetectorOptions {
18 /** Keys to ignore when detecting keyboard input modality. */
19 ignoreKeys?: number[];
20}
21/**
22 * Injectable options for the InputModalityDetector. These are shallowly merged with the default
23 * options.
24 */
25export declare const INPUT_MODALITY_DETECTOR_OPTIONS: InjectionToken<InputModalityDetectorOptions>;
26/**
27 * Default options for the InputModalityDetector.
28 *
29 * Modifier keys are ignored by default (i.e. when pressed won't cause the service to detect
30 * keyboard input modality) for two reasons:
31 *
32 * 1. Modifier keys are commonly used with mouse to perform actions such as 'right click' or 'open
33 * in new tab', and are thus less representative of actual keyboard interaction.
34 * 2. VoiceOver triggers some keyboard events when linearly navigating with Control + Option (but
35 * confusingly not with Caps Lock). Thus, to have parity with other screen readers, we ignore
36 * these keys so as to not update the input modality.
37 *
38 * Note that we do not by default ignore the right Meta key on Safari because it has the same key
39 * code as the ContextMenu key on other browsers. When we switch to using event.key, we can
40 * distinguish between the two.
41 */
42export declare const INPUT_MODALITY_DETECTOR_DEFAULT_OPTIONS: InputModalityDetectorOptions;
43/**
44 * The amount of time needed to pass after a touchstart event in order for a subsequent mousedown
45 * event to be attributed as mouse and not touch.
46 *
47 * This is the value used by AngularJS Material. Through trial and error (on iPhone 6S) they found
48 * that a value of around 650ms seems appropriate.
49 */
50export declare const TOUCH_BUFFER_MS = 650;
51/**
52 * Service that detects the user's input modality.
53 *
54 * This service does not update the input modality when a user navigates with a screen reader
55 * (e.g. linear navigation with VoiceOver, object navigation / browse mode with NVDA, virtual PC
56 * cursor mode with JAWS). This is in part due to technical limitations (i.e. keyboard events do not
57 * fire as expected in these modes) but is also arguably the correct behavior. Navigating with a
58 * screen reader is akin to visually scanning a page, and should not be interpreted as actual user
59 * input interaction.
60 *
61 * When a user is not navigating but *interacting* with a screen reader, this service attempts to
62 * update the input modality to keyboard, but in general this service's behavior is largely
63 * undefined.
64 */
65export declare class InputModalityDetector implements OnDestroy {
66 private readonly _platform;
67 /** Emits whenever an input modality is detected. */
68 readonly modalityDetected: Observable<InputModality>;
69 /** Emits when the input modality changes. */
70 readonly modalityChanged: Observable<InputModality>;
71 /** The most recently detected input modality. */
72 get mostRecentModality(): InputModality;
73 /**
74 * The most recently detected input modality event target. Is null if no input modality has been
75 * detected or if the associated event target is null for some unknown reason.
76 */
77 _mostRecentTarget: HTMLElement | null;
78 /** The underlying BehaviorSubject that emits whenever an input modality is detected. */
79 private readonly _modality;
80 /** Options for this InputModalityDetector. */
81 private readonly _options;
82 /**
83 * The timestamp of the last touch input modality. Used to determine whether mousedown events
84 * should be attributed to mouse or touch.
85 */
86 private _lastTouchMs;
87 /**
88 * Handles keydown events. Must be an arrow function in order to preserve the context when it gets
89 * bound.
90 */
91 private _onKeydown;
92 /**
93 * Handles mousedown events. Must be an arrow function in order to preserve the context when it
94 * gets bound.
95 */
96 private _onMousedown;
97 /**
98 * Handles touchstart events. Must be an arrow function in order to preserve the context when it
99 * gets bound.
100 */
101 private _onTouchstart;
102 constructor(_platform: Platform, ngZone: NgZone, document: Document, options?: InputModalityDetectorOptions);
103 ngOnDestroy(): void;
104 static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<InputModalityDetector, [null, null, null, { optional: true; }]>;
105}
106
107//# sourceMappingURL=input-modality-detector.d.ts.map
Note: See TracBrowser for help on using the repository browser.