@angular/cdk 7.0.3 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/a11y/typings/focus-monitor/focus-monitor.d.ts +20 -4
  2. package/a11y/typings/index.metadata.json +1 -1
  3. package/a11y/typings/key-manager/list-key-manager.d.ts +8 -0
  4. package/a11y/typings/live-announcer/live-announcer.d.ts +37 -4
  5. package/bidi/typings/dir.d.ts +4 -1
  6. package/bidi/typings/index.metadata.json +1 -1
  7. package/bundles/cdk-a11y.umd.js +503 -210
  8. package/bundles/cdk-a11y.umd.js.map +1 -1
  9. package/bundles/cdk-a11y.umd.min.js +1 -1
  10. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  11. package/bundles/cdk-accordion.umd.js +16 -9
  12. package/bundles/cdk-accordion.umd.js.map +1 -1
  13. package/bundles/cdk-accordion.umd.min.js.map +1 -1
  14. package/bundles/cdk-bidi.umd.js +16 -7
  15. package/bundles/cdk-bidi.umd.js.map +1 -1
  16. package/bundles/cdk-bidi.umd.min.js +1 -1
  17. package/bundles/cdk-bidi.umd.min.js.map +1 -1
  18. package/bundles/cdk-coercion.umd.js +5 -5
  19. package/bundles/cdk-coercion.umd.js.map +1 -1
  20. package/bundles/cdk-collections.umd.js +28 -5
  21. package/bundles/cdk-collections.umd.js.map +1 -1
  22. package/bundles/cdk-collections.umd.min.js.map +1 -1
  23. package/bundles/cdk-drag-drop.umd.js +2251 -853
  24. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  25. package/bundles/cdk-drag-drop.umd.min.js +2 -1
  26. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  27. package/bundles/cdk-keycodes.umd.js +33 -1
  28. package/bundles/cdk-keycodes.umd.js.map +1 -1
  29. package/bundles/cdk-keycodes.umd.min.js +1 -1
  30. package/bundles/cdk-keycodes.umd.min.js.map +1 -1
  31. package/bundles/cdk-layout.umd.js +29 -22
  32. package/bundles/cdk-layout.umd.js.map +1 -1
  33. package/bundles/cdk-layout.umd.min.js +1 -1
  34. package/bundles/cdk-layout.umd.min.js.map +1 -1
  35. package/bundles/cdk-observers.umd.js +25 -6
  36. package/bundles/cdk-observers.umd.js.map +1 -1
  37. package/bundles/cdk-observers.umd.min.js.map +1 -1
  38. package/bundles/cdk-overlay.umd.js +600 -243
  39. package/bundles/cdk-overlay.umd.js.map +1 -1
  40. package/bundles/cdk-overlay.umd.min.js +2 -2
  41. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  42. package/bundles/cdk-platform.umd.js +50 -28
  43. package/bundles/cdk-platform.umd.js.map +1 -1
  44. package/bundles/cdk-platform.umd.min.js.map +1 -1
  45. package/bundles/cdk-portal.umd.js +14 -7
  46. package/bundles/cdk-portal.umd.js.map +1 -1
  47. package/bundles/cdk-portal.umd.min.js.map +1 -1
  48. package/bundles/cdk-scrolling.umd.js +143 -48
  49. package/bundles/cdk-scrolling.umd.js.map +1 -1
  50. package/bundles/cdk-scrolling.umd.min.js +1 -1
  51. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  52. package/bundles/cdk-stepper.umd.js +103 -19
  53. package/bundles/cdk-stepper.umd.js.map +1 -1
  54. package/bundles/cdk-stepper.umd.min.js +1 -1
  55. package/bundles/cdk-stepper.umd.min.js.map +1 -1
  56. package/bundles/cdk-table.umd.js +182 -48
  57. package/bundles/cdk-table.umd.js.map +1 -1
  58. package/bundles/cdk-table.umd.min.js.map +1 -1
  59. package/bundles/cdk-text-field.umd.js +70 -32
  60. package/bundles/cdk-text-field.umd.js.map +1 -1
  61. package/bundles/cdk-text-field.umd.min.js +1 -1
  62. package/bundles/cdk-text-field.umd.min.js.map +1 -1
  63. package/bundles/cdk-tree.umd.js +71 -34
  64. package/bundles/cdk-tree.umd.js.map +1 -1
  65. package/bundles/cdk-tree.umd.min.js +1 -1
  66. package/bundles/cdk-tree.umd.min.js.map +1 -1
  67. package/bundles/cdk.umd.js +5 -4
  68. package/bundles/cdk.umd.js.map +1 -1
  69. package/bundles/cdk.umd.min.js +1 -1
  70. package/bundles/cdk.umd.min.js.map +1 -1
  71. package/drag-drop/typings/{drag-handle.d.ts → directives/drag-handle.d.ts} +3 -0
  72. package/drag-drop/typings/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  73. package/drag-drop/typings/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  74. package/drag-drop/typings/directives/drag.d.ts +108 -0
  75. package/drag-drop/typings/directives/drop-list-group.d.ts +22 -0
  76. package/drag-drop/typings/directives/drop-list.d.ts +135 -0
  77. package/drag-drop/typings/drag-drop-registry.d.ts +8 -5
  78. package/drag-drop/typings/drag-events.d.ts +24 -6
  79. package/{typings/esm5/drag-drop/drag.d.ts → drag-drop/typings/drag-ref.d.ts} +153 -77
  80. package/drag-drop/typings/drop-list-container.d.ts +21 -3
  81. package/drag-drop/typings/{drop-list.d.ts → drop-list-ref.d.ts} +133 -77
  82. package/drag-drop/typings/index.d.ts +1 -0
  83. package/drag-drop/typings/index.metadata.json +1 -1
  84. package/drag-drop/typings/public-api.d.ts +13 -5
  85. package/esm2015/a11y.js +353 -189
  86. package/esm2015/a11y.js.map +1 -1
  87. package/esm2015/accordion.js +16 -11
  88. package/esm2015/accordion.js.map +1 -1
  89. package/esm2015/bidi.js +18 -9
  90. package/esm2015/bidi.js.map +1 -1
  91. package/esm2015/cdk.js +7 -6
  92. package/esm2015/cdk.js.map +1 -1
  93. package/esm2015/coercion.js +7 -7
  94. package/esm2015/coercion.js.map +1 -1
  95. package/esm2015/collections.js +22 -7
  96. package/esm2015/collections.js.map +1 -1
  97. package/esm2015/drag-drop.js +1768 -751
  98. package/esm2015/drag-drop.js.map +1 -1
  99. package/esm2015/keycodes.js +31 -4
  100. package/esm2015/keycodes.js.map +1 -1
  101. package/esm2015/layout.js +29 -19
  102. package/esm2015/layout.js.map +1 -1
  103. package/esm2015/observers.js +13 -8
  104. package/esm2015/observers.js.map +1 -1
  105. package/esm2015/overlay.js +384 -219
  106. package/esm2015/overlay.js.map +1 -1
  107. package/esm2015/platform.js +53 -31
  108. package/esm2015/platform.js.map +1 -1
  109. package/esm2015/portal.js +13 -9
  110. package/esm2015/portal.js.map +1 -1
  111. package/esm2015/scrolling.js +106 -49
  112. package/esm2015/scrolling.js.map +1 -1
  113. package/esm2015/stepper.js +93 -24
  114. package/esm2015/stepper.js.map +1 -1
  115. package/esm2015/table.js +89 -45
  116. package/esm2015/table.js.map +1 -1
  117. package/esm2015/text-field.js +51 -34
  118. package/esm2015/text-field.js.map +1 -1
  119. package/esm2015/tree.js +55 -36
  120. package/esm2015/tree.js.map +1 -1
  121. package/esm5/a11y.es5.js +507 -214
  122. package/esm5/a11y.es5.js.map +1 -1
  123. package/esm5/accordion.es5.js +18 -11
  124. package/esm5/accordion.es5.js.map +1 -1
  125. package/esm5/bidi.es5.js +18 -9
  126. package/esm5/bidi.es5.js.map +1 -1
  127. package/esm5/cdk.es5.js +7 -6
  128. package/esm5/cdk.es5.js.map +1 -1
  129. package/esm5/coercion.es5.js +7 -7
  130. package/esm5/coercion.es5.js.map +1 -1
  131. package/esm5/collections.es5.js +35 -7
  132. package/esm5/collections.es5.js.map +1 -1
  133. package/esm5/drag-drop.es5.js +2125 -729
  134. package/esm5/drag-drop.es5.js.map +1 -1
  135. package/esm5/keycodes.es5.js +35 -4
  136. package/esm5/keycodes.es5.js.map +1 -1
  137. package/esm5/layout.es5.js +31 -24
  138. package/esm5/layout.es5.js.map +1 -1
  139. package/esm5/observers.es5.js +27 -8
  140. package/esm5/observers.es5.js.map +1 -1
  141. package/esm5/overlay.es5.js +602 -245
  142. package/esm5/overlay.es5.js.map +1 -1
  143. package/esm5/platform.es5.js +52 -30
  144. package/esm5/platform.es5.js.map +1 -1
  145. package/esm5/portal.es5.js +16 -9
  146. package/esm5/portal.es5.js.map +1 -1
  147. package/esm5/scrolling.es5.js +145 -50
  148. package/esm5/scrolling.es5.js.map +1 -1
  149. package/esm5/stepper.es5.js +106 -24
  150. package/esm5/stepper.es5.js.map +1 -1
  151. package/esm5/table.es5.js +184 -50
  152. package/esm5/table.es5.js.map +1 -1
  153. package/esm5/text-field.es5.js +72 -34
  154. package/esm5/text-field.es5.js.map +1 -1
  155. package/esm5/tree.es5.js +74 -37
  156. package/esm5/tree.es5.js.map +1 -1
  157. package/keycodes/typings/index.metadata.json +1 -1
  158. package/keycodes/typings/modifiers.d.ts +14 -0
  159. package/keycodes/typings/public-api.d.ts +1 -0
  160. package/overlay/typings/index.metadata.json +1 -1
  161. package/package.json +4 -4
  162. package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts +2 -2
  163. package/schematics/ng-update/upgrade-data.js +2 -1
  164. package/schematics/ng-update/upgrade-data.js.map +1 -1
  165. package/schematics/ng-update/upgrade-rules/index.js +3 -2
  166. package/schematics/ng-update/upgrade-rules/index.js.map +1 -1
  167. package/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  168. package/schematics/utils/ast/ng-module-imports.js +25 -13
  169. package/schematics/utils/ast/ng-module-imports.js.map +1 -1
  170. package/schematics/utils/get-project.js +2 -1
  171. package/schematics/utils/get-project.js.map +1 -1
  172. package/schematics/utils/parse5-element.js +3 -2
  173. package/schematics/utils/parse5-element.js.map +1 -1
  174. package/schematics/utils/project-targets.js +2 -1
  175. package/schematics/utils/project-targets.js.map +1 -1
  176. package/schematics/utils/version-agnostic-typescript.js +3 -2
  177. package/schematics/utils/version-agnostic-typescript.js.map +1 -1
  178. package/scrolling/typings/index.metadata.json +1 -1
  179. package/stepper/typings/index.metadata.json +1 -1
  180. package/stepper/typings/public-api.d.ts +1 -0
  181. package/stepper/typings/step-header.d.ts +15 -0
  182. package/stepper/typings/stepper.d.ts +11 -1
  183. package/text-field/typings/autosize.d.ts +6 -0
  184. package/text-field/typings/index.metadata.json +1 -1
  185. package/tree/typings/nested-node.d.ts +5 -5
  186. package/typings/a11y/focus-monitor/focus-monitor.d.ts +20 -4
  187. package/typings/a11y/index.metadata.json +1 -1
  188. package/typings/a11y/key-manager/list-key-manager.d.ts +8 -0
  189. package/typings/a11y/live-announcer/live-announcer.d.ts +37 -4
  190. package/typings/bidi/dir.d.ts +4 -1
  191. package/typings/bidi/index.metadata.json +1 -1
  192. package/typings/{esm5/drag-drop → drag-drop/directives}/drag-handle.d.ts +3 -0
  193. package/typings/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  194. package/typings/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  195. package/typings/drag-drop/directives/drag.d.ts +108 -0
  196. package/typings/drag-drop/directives/drop-list-group.d.ts +22 -0
  197. package/typings/drag-drop/directives/drop-list.d.ts +135 -0
  198. package/typings/drag-drop/drag-drop-registry.d.ts +8 -5
  199. package/typings/drag-drop/drag-events.d.ts +24 -6
  200. package/typings/drag-drop/{drag.d.ts → drag-ref.d.ts} +153 -77
  201. package/typings/drag-drop/drop-list-container.d.ts +21 -3
  202. package/typings/{esm5/drag-drop/drop-list.d.ts → drag-drop/drop-list-ref.d.ts} +133 -77
  203. package/typings/drag-drop/index.d.ts +1 -0
  204. package/typings/drag-drop/index.metadata.json +1 -1
  205. package/typings/drag-drop/public-api.d.ts +13 -5
  206. package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +20 -4
  207. package/typings/esm5/a11y/index.metadata.json +1 -1
  208. package/typings/esm5/a11y/key-manager/list-key-manager.d.ts +8 -0
  209. package/typings/esm5/a11y/live-announcer/live-announcer.d.ts +37 -4
  210. package/typings/esm5/bidi/dir.d.ts +4 -1
  211. package/typings/esm5/bidi/index.metadata.json +1 -1
  212. package/typings/{drag-drop → esm5/drag-drop/directives}/drag-handle.d.ts +3 -0
  213. package/typings/esm5/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  214. package/typings/esm5/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  215. package/typings/esm5/drag-drop/directives/drag.d.ts +108 -0
  216. package/typings/esm5/drag-drop/directives/drop-list-group.d.ts +22 -0
  217. package/typings/esm5/drag-drop/directives/drop-list.d.ts +135 -0
  218. package/typings/esm5/drag-drop/drag-drop-registry.d.ts +8 -5
  219. package/typings/esm5/drag-drop/drag-events.d.ts +24 -6
  220. package/{drag-drop/typings/drag.d.ts → typings/esm5/drag-drop/drag-ref.d.ts} +153 -77
  221. package/typings/esm5/drag-drop/drop-list-container.d.ts +21 -3
  222. package/typings/{drag-drop/drop-list.d.ts → esm5/drag-drop/drop-list-ref.d.ts} +133 -77
  223. package/typings/esm5/drag-drop/index.d.ts +1 -0
  224. package/typings/esm5/drag-drop/index.metadata.json +1 -1
  225. package/typings/esm5/drag-drop/public-api.d.ts +13 -5
  226. package/typings/esm5/index.metadata.json +1 -1
  227. package/typings/esm5/keycodes/index.metadata.json +1 -1
  228. package/typings/esm5/keycodes/modifiers.d.ts +14 -0
  229. package/typings/esm5/keycodes/public-api.d.ts +1 -0
  230. package/typings/esm5/overlay/index.metadata.json +1 -1
  231. package/typings/esm5/scrolling/index.metadata.json +1 -1
  232. package/typings/esm5/stepper/index.metadata.json +1 -1
  233. package/typings/esm5/stepper/public-api.d.ts +1 -0
  234. package/typings/esm5/stepper/step-header.d.ts +15 -0
  235. package/typings/esm5/stepper/stepper.d.ts +11 -1
  236. package/typings/esm5/text-field/autosize.d.ts +6 -0
  237. package/typings/esm5/text-field/index.metadata.json +1 -1
  238. package/typings/esm5/tree/nested-node.d.ts +5 -5
  239. package/typings/index.metadata.json +1 -1
  240. package/typings/keycodes/index.metadata.json +1 -1
  241. package/typings/keycodes/modifiers.d.ts +14 -0
  242. package/typings/keycodes/public-api.d.ts +1 -0
  243. package/typings/overlay/index.metadata.json +1 -1
  244. package/typings/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  245. package/typings/scrolling/index.metadata.json +1 -1
  246. package/typings/stepper/index.metadata.json +1 -1
  247. package/typings/stepper/public-api.d.ts +1 -0
  248. package/typings/stepper/step-header.d.ts +15 -0
  249. package/typings/stepper/stepper.d.ts +11 -1
  250. package/typings/text-field/autosize.d.ts +6 -0
  251. package/typings/text-field/index.metadata.json +1 -1
  252. package/typings/tree/nested-node.d.ts +5 -5
@@ -42,12 +42,13 @@ function __extends(d, b) {
42
42
 
43
43
  /**
44
44
  * @fileoverview added by tsickle
45
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
45
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
46
46
  */
47
47
 
48
- /** *
48
+ /**
49
49
  * IDs are deliminated by an empty space, as per the spec.
50
- @type {?} */
50
+ * @type {?}
51
+ */
51
52
  var ID_DELIMINATOR = ' ';
52
53
  /**
53
54
  * Adds the given ID to the specified ARIA attribute on an element.
@@ -95,31 +96,37 @@ function getAriaReferenceIds(el, attr) {
95
96
 
96
97
  /**
97
98
  * @fileoverview added by tsickle
98
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
99
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
99
100
  */
100
- /** *
101
+ /**
101
102
  * ID used for the body container where all messages are appended.
102
- @type {?} */
103
+ * @type {?}
104
+ */
103
105
  var MESSAGES_CONTAINER_ID = 'cdk-describedby-message-container';
104
- /** *
106
+ /**
105
107
  * ID prefix used for each created message element.
106
- @type {?} */
108
+ * @type {?}
109
+ */
107
110
  var CDK_DESCRIBEDBY_ID_PREFIX = 'cdk-describedby-message';
108
- /** *
111
+ /**
109
112
  * Attribute given to each host element that is described by a message element.
110
- @type {?} */
113
+ * @type {?}
114
+ */
111
115
  var CDK_DESCRIBEDBY_HOST_ATTRIBUTE = 'cdk-describedby-host';
112
- /** *
116
+ /**
113
117
  * Global incremental identifier for each registered message element.
114
- @type {?} */
118
+ * @type {?}
119
+ */
115
120
  var nextId = 0;
116
- /** *
121
+ /**
117
122
  * Global map of all registered message elements that have been placed into the document.
118
- @type {?} */
123
+ * @type {?}
124
+ */
119
125
  var messageRegistry = new Map();
120
- /** *
126
+ /**
121
127
  * Container for all registered messages.
122
- @type {?} */
128
+ * @type {?}
129
+ */
123
130
  var messagesContainer = null;
124
131
  /**
125
132
  * Utility that creates visually hidden elements with a message content. Useful for elements that
@@ -216,12 +223,18 @@ var AriaDescriber = /** @class */ (function () {
216
223
  /**
217
224
  * Creates a new element in the visually hidden message container element with the message
218
225
  * as its content and adds it to the message registry.
226
+ */
227
+ /**
228
+ * Creates a new element in the visually hidden message container element with the message
229
+ * as its content and adds it to the message registry.
230
+ * @private
219
231
  * @param {?} message
220
232
  * @return {?}
221
233
  */
222
234
  AriaDescriber.prototype._createMessageElement = /**
223
235
  * Creates a new element in the visually hidden message container element with the message
224
236
  * as its content and adds it to the message registry.
237
+ * @private
225
238
  * @param {?} message
226
239
  * @return {?}
227
240
  */
@@ -229,18 +242,21 @@ var AriaDescriber = /** @class */ (function () {
229
242
  /** @type {?} */
230
243
  var messageElement = this._document.createElement('div');
231
244
  messageElement.setAttribute('id', CDK_DESCRIBEDBY_ID_PREFIX + "-" + nextId++);
232
- messageElement.appendChild(/** @type {?} */ ((this._document.createTextNode(message))));
233
- this._createMessagesContainer(); /** @type {?} */
234
- ((messagesContainer)).appendChild(messageElement);
245
+ messageElement.appendChild((/** @type {?} */ (this._document.createTextNode(message))));
246
+ this._createMessagesContainer();
247
+ (/** @type {?} */ (messagesContainer)).appendChild(messageElement);
235
248
  messageRegistry.set(message, { messageElement: messageElement, referenceCount: 0 });
236
249
  };
250
+ /** Deletes the message element from the global messages container. */
237
251
  /**
238
252
  * Deletes the message element from the global messages container.
253
+ * @private
239
254
  * @param {?} message
240
255
  * @return {?}
241
256
  */
242
257
  AriaDescriber.prototype._deleteMessageElement = /**
243
258
  * Deletes the message element from the global messages container.
259
+ * @private
244
260
  * @param {?} message
245
261
  * @return {?}
246
262
  */
@@ -254,12 +270,15 @@ var AriaDescriber = /** @class */ (function () {
254
270
  }
255
271
  messageRegistry.delete(message);
256
272
  };
273
+ /** Creates the global container for all aria-describedby messages. */
257
274
  /**
258
275
  * Creates the global container for all aria-describedby messages.
276
+ * @private
259
277
  * @return {?}
260
278
  */
261
279
  AriaDescriber.prototype._createMessagesContainer = /**
262
280
  * Creates the global container for all aria-describedby messages.
281
+ * @private
263
282
  * @return {?}
264
283
  */
265
284
  function () {
@@ -271,7 +290,7 @@ var AriaDescriber = /** @class */ (function () {
271
290
  // old container so we don't get duplicates. Doing this, instead of emptying the previous
272
291
  // container, should be slightly faster.
273
292
  if (preExistingContainer) {
274
- /** @type {?} */ ((preExistingContainer.parentNode)).removeChild(preExistingContainer);
293
+ (/** @type {?} */ (preExistingContainer.parentNode)).removeChild(preExistingContainer);
275
294
  }
276
295
  messagesContainer = this._document.createElement('div');
277
296
  messagesContainer.id = MESSAGES_CONTAINER_ID;
@@ -280,12 +299,15 @@ var AriaDescriber = /** @class */ (function () {
280
299
  this._document.body.appendChild(messagesContainer);
281
300
  }
282
301
  };
302
+ /** Deletes the global messages container. */
283
303
  /**
284
304
  * Deletes the global messages container.
305
+ * @private
285
306
  * @return {?}
286
307
  */
287
308
  AriaDescriber.prototype._deleteMessagesContainer = /**
288
309
  * Deletes the global messages container.
310
+ * @private
289
311
  * @return {?}
290
312
  */
291
313
  function () {
@@ -294,17 +316,21 @@ var AriaDescriber = /** @class */ (function () {
294
316
  messagesContainer = null;
295
317
  }
296
318
  };
319
+ /** Removes all cdk-describedby messages that are hosted through the element. */
297
320
  /**
298
321
  * Removes all cdk-describedby messages that are hosted through the element.
322
+ * @private
299
323
  * @param {?} element
300
324
  * @return {?}
301
325
  */
302
326
  AriaDescriber.prototype._removeCdkDescribedByReferenceIds = /**
303
327
  * Removes all cdk-describedby messages that are hosted through the element.
328
+ * @private
304
329
  * @param {?} element
305
330
  * @return {?}
306
331
  */
307
332
  function (element) {
333
+ // Remove all aria-describedby reference IDs that are prefixed by CDK_DESCRIBEDBY_ID_PREFIX
308
334
  /** @type {?} */
309
335
  var originalReferenceIds = getAriaReferenceIds(element, 'aria-describedby')
310
336
  .filter(function (id) { return id.indexOf(CDK_DESCRIBEDBY_ID_PREFIX) != 0; });
@@ -313,6 +339,11 @@ var AriaDescriber = /** @class */ (function () {
313
339
  /**
314
340
  * Adds a message reference to the element using aria-describedby and increments the registered
315
341
  * message's reference count.
342
+ */
343
+ /**
344
+ * Adds a message reference to the element using aria-describedby and increments the registered
345
+ * message's reference count.
346
+ * @private
316
347
  * @param {?} element
317
348
  * @param {?} message
318
349
  * @return {?}
@@ -320,13 +351,14 @@ var AriaDescriber = /** @class */ (function () {
320
351
  AriaDescriber.prototype._addMessageReference = /**
321
352
  * Adds a message reference to the element using aria-describedby and increments the registered
322
353
  * message's reference count.
354
+ * @private
323
355
  * @param {?} element
324
356
  * @param {?} message
325
357
  * @return {?}
326
358
  */
327
359
  function (element, message) {
328
360
  /** @type {?} */
329
- var registeredMessage = /** @type {?} */ ((messageRegistry.get(message)));
361
+ var registeredMessage = (/** @type {?} */ (messageRegistry.get(message)));
330
362
  // Add the aria-describedby reference and set the
331
363
  // describedby_host attribute to mark the element.
332
364
  addAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id);
@@ -336,6 +368,11 @@ var AriaDescriber = /** @class */ (function () {
336
368
  /**
337
369
  * Removes a message reference from the element using aria-describedby
338
370
  * and decrements the registered message's reference count.
371
+ */
372
+ /**
373
+ * Removes a message reference from the element using aria-describedby
374
+ * and decrements the registered message's reference count.
375
+ * @private
339
376
  * @param {?} element
340
377
  * @param {?} message
341
378
  * @return {?}
@@ -343,25 +380,29 @@ var AriaDescriber = /** @class */ (function () {
343
380
  AriaDescriber.prototype._removeMessageReference = /**
344
381
  * Removes a message reference from the element using aria-describedby
345
382
  * and decrements the registered message's reference count.
383
+ * @private
346
384
  * @param {?} element
347
385
  * @param {?} message
348
386
  * @return {?}
349
387
  */
350
388
  function (element, message) {
351
389
  /** @type {?} */
352
- var registeredMessage = /** @type {?} */ ((messageRegistry.get(message)));
390
+ var registeredMessage = (/** @type {?} */ (messageRegistry.get(message)));
353
391
  registeredMessage.referenceCount--;
354
392
  removeAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id);
355
393
  element.removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE);
356
394
  };
395
+ /** Returns true if the element has been described by the provided message ID. */
357
396
  /**
358
397
  * Returns true if the element has been described by the provided message ID.
398
+ * @private
359
399
  * @param {?} element
360
400
  * @param {?} message
361
401
  * @return {?}
362
402
  */
363
403
  AriaDescriber.prototype._isElementDescribedByMessage = /**
364
404
  * Returns true if the element has been described by the provided message ID.
405
+ * @private
365
406
  * @param {?} element
366
407
  * @param {?} message
367
408
  * @return {?}
@@ -375,14 +416,17 @@ var AriaDescriber = /** @class */ (function () {
375
416
  var messageId = registeredMessage && registeredMessage.messageElement.id;
376
417
  return !!messageId && referenceIds.indexOf(messageId) != -1;
377
418
  };
419
+ /** Determines whether a message can be described on a particular element. */
378
420
  /**
379
421
  * Determines whether a message can be described on a particular element.
422
+ * @private
380
423
  * @param {?} element
381
424
  * @param {?} message
382
425
  * @return {?}
383
426
  */
384
427
  AriaDescriber.prototype._canBeDescribed = /**
385
428
  * Determines whether a message can be described on a particular element.
429
+ * @private
386
430
  * @param {?} element
387
431
  * @param {?} message
388
432
  * @return {?}
@@ -410,32 +454,30 @@ var AriaDescriber = /** @class */ (function () {
410
454
  function ARIA_DESCRIBER_PROVIDER_FACTORY(parentDispatcher, _document) {
411
455
  return parentDispatcher || new AriaDescriber(_document);
412
456
  }
413
- /** *
457
+ /**
414
458
  * \@docs-private \@deprecated \@breaking-change 8.0.0
415
- @type {?} */
459
+ * @type {?}
460
+ */
416
461
  var ARIA_DESCRIBER_PROVIDER = {
417
462
  // If there is already an AriaDescriber available, use that. Otherwise, provide a new one.
418
463
  provide: AriaDescriber,
419
464
  deps: [
420
465
  [new core.Optional(), new core.SkipSelf(), AriaDescriber],
421
- /** @type {?} */ (common.DOCUMENT)
466
+ (/** @type {?} */ (common.DOCUMENT))
422
467
  ],
423
468
  useFactory: ARIA_DESCRIBER_PROVIDER_FACTORY
424
469
  };
425
470
 
426
471
  /**
427
472
  * @fileoverview added by tsickle
428
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
473
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
429
474
  */
430
- // unsupported: template constraints.
431
475
  /**
432
476
  * This class manages keyboard events for selectable lists. If you pass it a query list
433
477
  * of items, it will set the active item correctly when arrow events occur.
434
478
  * @template T
435
479
  */
436
- var
437
- // unsupported: template constraints.
438
- /**
480
+ var /**
439
481
  * This class manages keyboard events for selectable lists. If you pass it a query list
440
482
  * of items, it will set the active item correctly when arrow events occur.
441
483
  * @template T
@@ -445,15 +487,18 @@ ListKeyManager = /** @class */ (function () {
445
487
  var _this = this;
446
488
  this._items = _items;
447
489
  this._activeItemIndex = -1;
490
+ this._activeItem = null;
448
491
  this._wrap = false;
449
492
  this._letterKeyStream = new rxjs.Subject();
450
493
  this._typeaheadSubscription = rxjs.Subscription.EMPTY;
451
494
  this._vertical = true;
495
+ this._allowedModifierKeys = [];
452
496
  /**
453
497
  * Predicate function that can be used to check whether an item should be skipped
454
498
  * by the key manager. By default, disabled items are skipped.
455
499
  */
456
500
  this._skipPredicateFn = function (item) { return item.disabled; };
501
+ // Buffer for the letters that the user has pressed when the typeahead option is turned on.
457
502
  this._pressedLetters = [];
458
503
  /**
459
504
  * Stream that emits any time the TAB key is pressed, so components can react
@@ -489,18 +534,22 @@ ListKeyManager = /** @class */ (function () {
489
534
  /**
490
535
  * Sets the predicate function that determines which items should be skipped by the
491
536
  * list key manager.
537
+ * @template THIS
538
+ * @this {THIS}
492
539
  * @param {?} predicate Function that determines whether the given item should be skipped.
493
- * @return {?}
540
+ * @return {THIS}
494
541
  */
495
542
  ListKeyManager.prototype.skipPredicate = /**
496
543
  * Sets the predicate function that determines which items should be skipped by the
497
544
  * list key manager.
545
+ * @template THIS
546
+ * @this {THIS}
498
547
  * @param {?} predicate Function that determines whether the given item should be skipped.
499
- * @return {?}
548
+ * @return {THIS}
500
549
  */
501
550
  function (predicate) {
502
- this._skipPredicateFn = predicate;
503
- return this;
551
+ (/** @type {?} */ (this))._skipPredicateFn = predicate;
552
+ return (/** @type {?} */ (this));
504
553
  };
505
554
  /**
506
555
  * Configures wrapping mode, which determines whether the active item will wrap to
@@ -510,19 +559,23 @@ ListKeyManager = /** @class */ (function () {
510
559
  /**
511
560
  * Configures wrapping mode, which determines whether the active item will wrap to
512
561
  * the other end of list when there are no more items in the given direction.
562
+ * @template THIS
563
+ * @this {THIS}
513
564
  * @param {?=} shouldWrap Whether the list should wrap when reaching the end.
514
- * @return {?}
565
+ * @return {THIS}
515
566
  */
516
567
  ListKeyManager.prototype.withWrap = /**
517
568
  * Configures wrapping mode, which determines whether the active item will wrap to
518
569
  * the other end of list when there are no more items in the given direction.
570
+ * @template THIS
571
+ * @this {THIS}
519
572
  * @param {?=} shouldWrap Whether the list should wrap when reaching the end.
520
- * @return {?}
573
+ * @return {THIS}
521
574
  */
522
575
  function (shouldWrap) {
523
576
  if (shouldWrap === void 0) { shouldWrap = true; }
524
- this._wrap = shouldWrap;
525
- return this;
577
+ (/** @type {?} */ (this))._wrap = shouldWrap;
578
+ return (/** @type {?} */ (this));
526
579
  };
527
580
  /**
528
581
  * Configures whether the key manager should be able to move the selection vertically.
@@ -530,18 +583,22 @@ ListKeyManager = /** @class */ (function () {
530
583
  */
531
584
  /**
532
585
  * Configures whether the key manager should be able to move the selection vertically.
586
+ * @template THIS
587
+ * @this {THIS}
533
588
  * @param {?=} enabled Whether vertical selection should be enabled.
534
- * @return {?}
589
+ * @return {THIS}
535
590
  */
536
591
  ListKeyManager.prototype.withVerticalOrientation = /**
537
592
  * Configures whether the key manager should be able to move the selection vertically.
593
+ * @template THIS
594
+ * @this {THIS}
538
595
  * @param {?=} enabled Whether vertical selection should be enabled.
539
- * @return {?}
596
+ * @return {THIS}
540
597
  */
541
598
  function (enabled) {
542
599
  if (enabled === void 0) { enabled = true; }
543
- this._vertical = enabled;
544
- return this;
600
+ (/** @type {?} */ (this))._vertical = enabled;
601
+ return (/** @type {?} */ (this));
545
602
  };
546
603
  /**
547
604
  * Configures the key manager to move the selection horizontally.
@@ -551,18 +608,46 @@ ListKeyManager = /** @class */ (function () {
551
608
  /**
552
609
  * Configures the key manager to move the selection horizontally.
553
610
  * Passing in `null` will disable horizontal movement.
611
+ * @template THIS
612
+ * @this {THIS}
554
613
  * @param {?} direction Direction in which the selection can be moved.
555
- * @return {?}
614
+ * @return {THIS}
556
615
  */
557
616
  ListKeyManager.prototype.withHorizontalOrientation = /**
558
617
  * Configures the key manager to move the selection horizontally.
559
618
  * Passing in `null` will disable horizontal movement.
619
+ * @template THIS
620
+ * @this {THIS}
560
621
  * @param {?} direction Direction in which the selection can be moved.
561
- * @return {?}
622
+ * @return {THIS}
562
623
  */
563
624
  function (direction) {
564
- this._horizontal = direction;
565
- return this;
625
+ (/** @type {?} */ (this))._horizontal = direction;
626
+ return (/** @type {?} */ (this));
627
+ };
628
+ /**
629
+ * Modifier keys which are allowed to be held down and whose default actions will be prevented
630
+ * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys.
631
+ */
632
+ /**
633
+ * Modifier keys which are allowed to be held down and whose default actions will be prevented
634
+ * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys.
635
+ * @template THIS
636
+ * @this {THIS}
637
+ * @param {?} keys
638
+ * @return {THIS}
639
+ */
640
+ ListKeyManager.prototype.withAllowedModifierKeys = /**
641
+ * Modifier keys which are allowed to be held down and whose default actions will be prevented
642
+ * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys.
643
+ * @template THIS
644
+ * @this {THIS}
645
+ * @param {?} keys
646
+ * @return {THIS}
647
+ */
648
+ function (keys) {
649
+ (/** @type {?} */ (this))._allowedModifierKeys = keys;
650
+ return (/** @type {?} */ (this));
566
651
  };
567
652
  /**
568
653
  * Turns on typeahead mode which allows users to set the active item by typing.
@@ -570,42 +655,47 @@ ListKeyManager = /** @class */ (function () {
570
655
  */
571
656
  /**
572
657
  * Turns on typeahead mode which allows users to set the active item by typing.
658
+ * @template THIS
659
+ * @this {THIS}
573
660
  * @param {?=} debounceInterval Time to wait after the last keystroke before setting the active item.
574
- * @return {?}
661
+ * @return {THIS}
575
662
  */
576
663
  ListKeyManager.prototype.withTypeAhead = /**
577
664
  * Turns on typeahead mode which allows users to set the active item by typing.
665
+ * @template THIS
666
+ * @this {THIS}
578
667
  * @param {?=} debounceInterval Time to wait after the last keystroke before setting the active item.
579
- * @return {?}
668
+ * @return {THIS}
580
669
  */
581
670
  function (debounceInterval) {
582
671
  var _this = this;
583
672
  if (debounceInterval === void 0) { debounceInterval = 200; }
584
- if (this._items.length && this._items.some(function (item) { return typeof item.getLabel !== 'function'; })) {
673
+ if ((/** @type {?} */ (this))._items.length && (/** @type {?} */ (this))._items.some(function (item) { return typeof item.getLabel !== 'function'; })) {
585
674
  throw Error('ListKeyManager items in typeahead mode must implement the `getLabel` method.');
586
675
  }
587
- this._typeaheadSubscription.unsubscribe();
676
+ (/** @type {?} */ (this))._typeaheadSubscription.unsubscribe();
588
677
  // Debounce the presses of non-navigational keys, collect the ones that correspond to letters
589
678
  // and convert those letters back into a string. Afterwards find the first item that starts
590
679
  // with that string and select it.
591
- this._typeaheadSubscription = this._letterKeyStream.pipe(operators.tap(function (keyCode) { return _this._pressedLetters.push(keyCode); }), operators.debounceTime(debounceInterval), operators.filter(function () { return _this._pressedLetters.length > 0; }), operators.map(function () { return _this._pressedLetters.join(''); })).subscribe(function (inputString) {
680
+ (/** @type {?} */ (this))._typeaheadSubscription = (/** @type {?} */ (this))._letterKeyStream.pipe(operators.tap(function (keyCode) { return (/** @type {?} */ (_this))._pressedLetters.push(keyCode); }), operators.debounceTime(debounceInterval), operators.filter(function () { return (/** @type {?} */ (_this))._pressedLetters.length > 0; }), operators.map(function () { return (/** @type {?} */ (_this))._pressedLetters.join(''); })).subscribe(function (inputString) {
592
681
  /** @type {?} */
593
- var items = _this._getItemsArray();
682
+ var items = (/** @type {?} */ (_this))._getItemsArray();
594
683
  // Start at 1 because we want to start searching at the item immediately
595
684
  // following the current active item.
596
685
  for (var i = 1; i < items.length + 1; i++) {
597
686
  /** @type {?} */
598
- var index = (_this._activeItemIndex + i) % items.length;
687
+ var index = ((/** @type {?} */ (_this))._activeItemIndex + i) % items.length;
599
688
  /** @type {?} */
600
689
  var item = items[index];
601
- if (!_this._skipPredicateFn(item) && /** @type {?} */ ((item.getLabel))().toUpperCase().trim().indexOf(inputString) === 0) {
602
- _this.setActiveItem(index);
690
+ if (!(/** @type {?} */ (_this))._skipPredicateFn(item) &&
691
+ (/** @type {?} */ (item.getLabel))().toUpperCase().trim().indexOf(inputString) === 0) {
692
+ (/** @type {?} */ (_this)).setActiveItem(index);
603
693
  break;
604
694
  }
605
695
  }
606
- _this._pressedLetters = [];
696
+ (/** @type {?} */ (_this))._pressedLetters = [];
607
697
  });
608
- return this;
698
+ return (/** @type {?} */ (this));
609
699
  };
610
700
  /**
611
701
  * @param {?} item
@@ -638,14 +728,21 @@ ListKeyManager = /** @class */ (function () {
638
728
  * @return {?}
639
729
  */
640
730
  function (event) {
731
+ var _this = this;
641
732
  /** @type {?} */
642
733
  var keyCode = event.keyCode;
734
+ /** @type {?} */
735
+ var modifiers = ['altKey', 'ctrlKey', 'metaKey', 'shiftKey'];
736
+ /** @type {?} */
737
+ var isModifierAllowed = modifiers.every(function (modifier) {
738
+ return !event[modifier] || _this._allowedModifierKeys.indexOf(modifier) > -1;
739
+ });
643
740
  switch (keyCode) {
644
741
  case keycodes.TAB:
645
742
  this.tabOut.next();
646
743
  return;
647
744
  case keycodes.DOWN_ARROW:
648
- if (this._vertical) {
745
+ if (this._vertical && isModifierAllowed) {
649
746
  this.setNextItemActive();
650
747
  break;
651
748
  }
@@ -653,7 +750,7 @@ ListKeyManager = /** @class */ (function () {
653
750
  return;
654
751
  }
655
752
  case keycodes.UP_ARROW:
656
- if (this._vertical) {
753
+ if (this._vertical && isModifierAllowed) {
657
754
  this.setPreviousItemActive();
658
755
  break;
659
756
  }
@@ -661,37 +758,31 @@ ListKeyManager = /** @class */ (function () {
661
758
  return;
662
759
  }
663
760
  case keycodes.RIGHT_ARROW:
664
- if (this._horizontal === 'ltr') {
665
- this.setNextItemActive();
666
- break;
667
- }
668
- else if (this._horizontal === 'rtl') {
669
- this.setPreviousItemActive();
761
+ if (this._horizontal && isModifierAllowed) {
762
+ this._horizontal === 'rtl' ? this.setPreviousItemActive() : this.setNextItemActive();
670
763
  break;
671
764
  }
672
765
  else {
673
766
  return;
674
767
  }
675
768
  case keycodes.LEFT_ARROW:
676
- if (this._horizontal === 'ltr') {
677
- this.setPreviousItemActive();
678
- break;
679
- }
680
- else if (this._horizontal === 'rtl') {
681
- this.setNextItemActive();
769
+ if (this._horizontal && isModifierAllowed) {
770
+ this._horizontal === 'rtl' ? this.setNextItemActive() : this.setPreviousItemActive();
682
771
  break;
683
772
  }
684
773
  else {
685
774
  return;
686
775
  }
687
776
  default:
688
- // Attempt to use the `event.key` which also maps it to the user's keyboard language,
689
- // otherwise fall back to resolving alphanumeric characters via the keyCode.
690
- if (event.key && event.key.length === 1) {
691
- this._letterKeyStream.next(event.key.toLocaleUpperCase());
692
- }
693
- else if ((keyCode >= keycodes.A && keyCode <= keycodes.Z) || (keyCode >= keycodes.ZERO && keyCode <= keycodes.NINE)) {
694
- this._letterKeyStream.next(String.fromCharCode(keyCode));
777
+ if (isModifierAllowed || keycodes.hasModifierKey(event, 'shiftKey')) {
778
+ // Attempt to use the `event.key` which also maps it to the user's keyboard language,
779
+ // otherwise fall back to resolving alphanumeric characters via the keyCode.
780
+ if (event.key && event.key.length === 1) {
781
+ this._letterKeyStream.next(event.key.toLocaleUpperCase());
782
+ }
783
+ else if ((keyCode >= keycodes.A && keyCode <= keycodes.Z) || (keyCode >= keycodes.ZERO && keyCode <= keycodes.NINE)) {
784
+ this._letterKeyStream.next(String.fromCharCode(keyCode));
785
+ }
695
786
  }
696
787
  // Note that we return here, in order to avoid preventing
697
788
  // the default action of non-navigational keys.
@@ -786,8 +877,11 @@ ListKeyManager = /** @class */ (function () {
786
877
  var itemArray = this._getItemsArray();
787
878
  /** @type {?} */
788
879
  var index = typeof item === 'number' ? item : itemArray.indexOf(item);
880
+ /** @type {?} */
881
+ var activeItem = itemArray[index];
882
+ // Explicitly check for `null` and `undefined` because other falsy values are valid.
883
+ this._activeItem = activeItem == null ? null : activeItem;
789
884
  this._activeItemIndex = index;
790
- this._activeItem = itemArray[index];
791
885
  };
792
886
  /**
793
887
  * Allows setting of the activeItemIndex without any other effects.
@@ -816,6 +910,12 @@ ListKeyManager = /** @class */ (function () {
816
910
  * This method sets the active item, given a list of items and the delta between the
817
911
  * currently active item and the new active item. It will calculate differently
818
912
  * depending on whether wrap mode is turned on.
913
+ */
914
+ /**
915
+ * This method sets the active item, given a list of items and the delta between the
916
+ * currently active item and the new active item. It will calculate differently
917
+ * depending on whether wrap mode is turned on.
918
+ * @private
819
919
  * @param {?} delta
820
920
  * @return {?}
821
921
  */
@@ -823,6 +923,7 @@ ListKeyManager = /** @class */ (function () {
823
923
  * This method sets the active item, given a list of items and the delta between the
824
924
  * currently active item and the new active item. It will calculate differently
825
925
  * depending on whether wrap mode is turned on.
926
+ * @private
826
927
  * @param {?} delta
827
928
  * @return {?}
828
929
  */
@@ -833,6 +934,12 @@ ListKeyManager = /** @class */ (function () {
833
934
  * Sets the active item properly given "wrap" mode. In other words, it will continue to move
834
935
  * down the list until it finds an item that is not disabled, and it will wrap if it
835
936
  * encounters either end of the list.
937
+ */
938
+ /**
939
+ * Sets the active item properly given "wrap" mode. In other words, it will continue to move
940
+ * down the list until it finds an item that is not disabled, and it will wrap if it
941
+ * encounters either end of the list.
942
+ * @private
836
943
  * @param {?} delta
837
944
  * @return {?}
838
945
  */
@@ -840,6 +947,7 @@ ListKeyManager = /** @class */ (function () {
840
947
  * Sets the active item properly given "wrap" mode. In other words, it will continue to move
841
948
  * down the list until it finds an item that is not disabled, and it will wrap if it
842
949
  * encounters either end of the list.
950
+ * @private
843
951
  * @param {?} delta
844
952
  * @return {?}
845
953
  */
@@ -861,6 +969,12 @@ ListKeyManager = /** @class */ (function () {
861
969
  * Sets the active item properly given the default mode. In other words, it will
862
970
  * continue to move down the list until it finds an item that is not disabled. If
863
971
  * it encounters either end of the list, it will stop and not wrap.
972
+ */
973
+ /**
974
+ * Sets the active item properly given the default mode. In other words, it will
975
+ * continue to move down the list until it finds an item that is not disabled. If
976
+ * it encounters either end of the list, it will stop and not wrap.
977
+ * @private
864
978
  * @param {?} delta
865
979
  * @return {?}
866
980
  */
@@ -868,6 +982,7 @@ ListKeyManager = /** @class */ (function () {
868
982
  * Sets the active item properly given the default mode. In other words, it will
869
983
  * continue to move down the list until it finds an item that is not disabled. If
870
984
  * it encounters either end of the list, it will stop and not wrap.
985
+ * @private
871
986
  * @param {?} delta
872
987
  * @return {?}
873
988
  */
@@ -878,6 +993,12 @@ ListKeyManager = /** @class */ (function () {
878
993
  * Sets the active item to the first enabled item starting at the index specified. If the
879
994
  * item is disabled, it will move in the fallbackDelta direction until it either
880
995
  * finds an enabled item or encounters the end of the list.
996
+ */
997
+ /**
998
+ * Sets the active item to the first enabled item starting at the index specified. If the
999
+ * item is disabled, it will move in the fallbackDelta direction until it either
1000
+ * finds an enabled item or encounters the end of the list.
1001
+ * @private
881
1002
  * @param {?} index
882
1003
  * @param {?} fallbackDelta
883
1004
  * @return {?}
@@ -886,6 +1007,7 @@ ListKeyManager = /** @class */ (function () {
886
1007
  * Sets the active item to the first enabled item starting at the index specified. If the
887
1008
  * item is disabled, it will move in the fallbackDelta direction until it either
888
1009
  * finds an enabled item or encounters the end of the list.
1010
+ * @private
889
1011
  * @param {?} index
890
1012
  * @param {?} fallbackDelta
891
1013
  * @return {?}
@@ -904,12 +1026,15 @@ ListKeyManager = /** @class */ (function () {
904
1026
  }
905
1027
  this.setActiveItem(index);
906
1028
  };
1029
+ /** Returns the items as an array. */
907
1030
  /**
908
1031
  * Returns the items as an array.
1032
+ * @private
909
1033
  * @return {?}
910
1034
  */
911
1035
  ListKeyManager.prototype._getItemsArray = /**
912
1036
  * Returns the items as an array.
1037
+ * @private
913
1038
  * @return {?}
914
1039
  */
915
1040
  function () {
@@ -920,7 +1045,7 @@ ListKeyManager = /** @class */ (function () {
920
1045
 
921
1046
  /**
922
1047
  * @fileoverview added by tsickle
923
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1048
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
924
1049
  */
925
1050
  /**
926
1051
  * @template T
@@ -955,7 +1080,7 @@ ActiveDescendantKeyManager = /** @class */ (function (_super) {
955
1080
 
956
1081
  /**
957
1082
  * @fileoverview added by tsickle
958
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1083
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
959
1084
  */
960
1085
  /**
961
1086
  * @template T
@@ -976,17 +1101,21 @@ FocusKeyManager = /** @class */ (function (_super) {
976
1101
  */
977
1102
  /**
978
1103
  * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.
1104
+ * @template THIS
1105
+ * @this {THIS}
979
1106
  * @param {?} origin Focus origin to be used when focusing items.
980
- * @return {?}
1107
+ * @return {THIS}
981
1108
  */
982
1109
  FocusKeyManager.prototype.setFocusOrigin = /**
983
1110
  * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.
1111
+ * @template THIS
1112
+ * @this {THIS}
984
1113
  * @param {?} origin Focus origin to be used when focusing items.
985
- * @return {?}
1114
+ * @return {THIS}
986
1115
  */
987
1116
  function (origin) {
988
- this._origin = origin;
989
- return this;
1117
+ (/** @type {?} */ (this))._origin = origin;
1118
+ return (/** @type {?} */ (this));
990
1119
  };
991
1120
  /**
992
1121
  * @param {?} item
@@ -1007,8 +1136,11 @@ FocusKeyManager = /** @class */ (function (_super) {
1007
1136
 
1008
1137
  /**
1009
1138
  * @fileoverview added by tsickle
1010
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1139
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1011
1140
  */
1141
+ // The InteractivityChecker leans heavily on the ally.js accessibility utilities.
1142
+ // Methods like `isTabbable` are only covering specific edge-cases for the browsers which are
1143
+ // supported.
1012
1144
  /**
1013
1145
  * Utility for checking the interactivity of an element, such as whether is is focusable or
1014
1146
  * tabbable.
@@ -1197,7 +1329,7 @@ var InteractivityChecker = /** @class */ (function () {
1197
1329
  */
1198
1330
  function getFrameElement(window) {
1199
1331
  try {
1200
- return /** @type {?} */ (window.frameElement);
1332
+ return (/** @type {?} */ (window.frameElement));
1201
1333
  }
1202
1334
  catch (_a) {
1203
1335
  return null;
@@ -1286,6 +1418,7 @@ function getTabIndexValue(element) {
1286
1418
  if (!hasValidTabIndex(element)) {
1287
1419
  return null;
1288
1420
  }
1421
+ // See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
1289
1422
  /** @type {?} */
1290
1423
  var tabIndex = parseInt(element.getAttribute('tabindex') || '', 10);
1291
1424
  return isNaN(tabIndex) ? -1 : tabIndex;
@@ -1299,7 +1432,7 @@ function isPotentiallyTabbableIOS(element) {
1299
1432
  /** @type {?} */
1300
1433
  var nodeName = element.nodeName.toLowerCase();
1301
1434
  /** @type {?} */
1302
- var inputType = nodeName === 'input' && (/** @type {?} */ (element)).type;
1435
+ var inputType = nodeName === 'input' && ((/** @type {?} */ (element))).type;
1303
1436
  return inputType === 'text'
1304
1437
  || inputType === 'password'
1305
1438
  || nodeName === 'select'
@@ -1333,7 +1466,7 @@ function getWindow(node) {
1333
1466
 
1334
1467
  /**
1335
1468
  * @fileoverview added by tsickle
1336
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1469
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1337
1470
  */
1338
1471
  /**
1339
1472
  * Class that allows for trapping focus within a DOM element.
@@ -1427,17 +1560,17 @@ FocusTrap = /** @class */ (function () {
1427
1560
  }
1428
1561
  this._ngZone.runOutsideAngular(function () {
1429
1562
  if (!_this._startAnchor) {
1430
- _this._startAnchor = _this._createAnchor(); /** @type {?} */
1431
- ((_this._startAnchor)).addEventListener('focus', function () { return _this.focusLastTabbableElement(); });
1563
+ _this._startAnchor = _this._createAnchor();
1564
+ (/** @type {?} */ (_this._startAnchor)).addEventListener('focus', function () { return _this.focusLastTabbableElement(); });
1432
1565
  }
1433
1566
  if (!_this._endAnchor) {
1434
- _this._endAnchor = _this._createAnchor(); /** @type {?} */
1435
- ((_this._endAnchor)).addEventListener('focus', function () { return _this.focusFirstTabbableElement(); });
1567
+ _this._endAnchor = _this._createAnchor();
1568
+ (/** @type {?} */ (_this._endAnchor)).addEventListener('focus', function () { return _this.focusFirstTabbableElement(); });
1436
1569
  }
1437
1570
  });
1438
1571
  if (this._element.parentNode) {
1439
- this._element.parentNode.insertBefore(/** @type {?} */ ((this._startAnchor)), this._element);
1440
- this._element.parentNode.insertBefore(/** @type {?} */ ((this._endAnchor)), this._element.nextSibling);
1572
+ this._element.parentNode.insertBefore((/** @type {?} */ (this._startAnchor)), this._element);
1573
+ this._element.parentNode.insertBefore((/** @type {?} */ (this._endAnchor)), this._element.nextSibling);
1441
1574
  this._hasAttached = true;
1442
1575
  }
1443
1576
  return this._hasAttached;
@@ -1516,19 +1649,27 @@ FocusTrap = /** @class */ (function () {
1516
1649
  };
1517
1650
  /**
1518
1651
  * Get the specified boundary element of the trapped region.
1652
+ * @param bound The boundary to get (start or end of trapped region).
1653
+ * @returns The boundary element.
1654
+ */
1655
+ /**
1656
+ * Get the specified boundary element of the trapped region.
1657
+ * @private
1519
1658
  * @param {?} bound The boundary to get (start or end of trapped region).
1520
1659
  * @return {?} The boundary element.
1521
1660
  */
1522
1661
  FocusTrap.prototype._getRegionBoundary = /**
1523
1662
  * Get the specified boundary element of the trapped region.
1663
+ * @private
1524
1664
  * @param {?} bound The boundary to get (start or end of trapped region).
1525
1665
  * @return {?} The boundary element.
1526
1666
  */
1527
1667
  function (bound) {
1668
+ // Contains the deprecated version of selector, for temporary backwards comparability.
1528
1669
  /** @type {?} */
1529
- var markers = /** @type {?} */ (this._element.querySelectorAll("[cdk-focus-region-" + bound + "], " +
1670
+ var markers = (/** @type {?} */ (this._element.querySelectorAll("[cdk-focus-region-" + bound + "], " +
1530
1671
  ("[cdkFocusRegion" + bound + "], ") +
1531
- ("[cdk-focus-" + bound + "]")));
1672
+ ("[cdk-focus-" + bound + "]"))));
1532
1673
  for (var i = 0; i < markers.length; i++) {
1533
1674
  // @breaking-change 8.0.0
1534
1675
  if (markers[i].hasAttribute("cdk-focus-" + bound)) {
@@ -1561,9 +1702,10 @@ FocusTrap = /** @class */ (function () {
1561
1702
  * @return {?} Whether focus was moved successfuly.
1562
1703
  */
1563
1704
  function () {
1705
+ // Contains the deprecated version of selector, for temporary backwards comparability.
1564
1706
  /** @type {?} */
1565
- var redirectToElement = /** @type {?} */ (this._element.querySelector("[cdk-focus-initial], " +
1566
- "[cdkFocusInitial]"));
1707
+ var redirectToElement = (/** @type {?} */ (this._element.querySelector("[cdk-focus-initial], " +
1708
+ "[cdkFocusInitial]")));
1567
1709
  if (redirectToElement) {
1568
1710
  // @breaking-change 8.0.0
1569
1711
  if (redirectToElement.hasAttribute("cdk-focus-initial")) {
@@ -1571,6 +1713,11 @@ FocusTrap = /** @class */ (function () {
1571
1713
  "use 'cdkFocusInitial' instead. The deprecated attribute " +
1572
1714
  "will be removed in 8.0.0", redirectToElement);
1573
1715
  }
1716
+ // Warn the consumer if the element they've pointed to
1717
+ // isn't focusable, when not in production mode.
1718
+ if (core.isDevMode() && !this._checker.isFocusable(redirectToElement)) {
1719
+ console.warn("Element matching '[cdkFocusInitial]' is not focusable.", redirectToElement);
1720
+ }
1574
1721
  redirectToElement.focus();
1575
1722
  return true;
1576
1723
  }
@@ -1630,13 +1777,16 @@ FocusTrap = /** @class */ (function () {
1630
1777
  function () {
1631
1778
  return this._hasAttached;
1632
1779
  };
1780
+ /** Get the first tabbable element from a DOM subtree (inclusive). */
1633
1781
  /**
1634
1782
  * Get the first tabbable element from a DOM subtree (inclusive).
1783
+ * @private
1635
1784
  * @param {?} root
1636
1785
  * @return {?}
1637
1786
  */
1638
1787
  FocusTrap.prototype._getFirstTabbableElement = /**
1639
1788
  * Get the first tabbable element from a DOM subtree (inclusive).
1789
+ * @private
1640
1790
  * @param {?} root
1641
1791
  * @return {?}
1642
1792
  */
@@ -1644,12 +1794,14 @@ FocusTrap = /** @class */ (function () {
1644
1794
  if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) {
1645
1795
  return root;
1646
1796
  }
1797
+ // Iterate in DOM order. Note that IE doesn't have `children` for SVG so we fall
1798
+ // back to `childNodes` which includes text nodes, comments etc.
1647
1799
  /** @type {?} */
1648
1800
  var children = root.children || root.childNodes;
1649
1801
  for (var i = 0; i < children.length; i++) {
1650
1802
  /** @type {?} */
1651
1803
  var tabbableChild = children[i].nodeType === this._document.ELEMENT_NODE ?
1652
- this._getFirstTabbableElement(/** @type {?} */ (children[i])) :
1804
+ this._getFirstTabbableElement((/** @type {?} */ (children[i]))) :
1653
1805
  null;
1654
1806
  if (tabbableChild) {
1655
1807
  return tabbableChild;
@@ -1657,13 +1809,16 @@ FocusTrap = /** @class */ (function () {
1657
1809
  }
1658
1810
  return null;
1659
1811
  };
1812
+ /** Get the last tabbable element from a DOM subtree (inclusive). */
1660
1813
  /**
1661
1814
  * Get the last tabbable element from a DOM subtree (inclusive).
1815
+ * @private
1662
1816
  * @param {?} root
1663
1817
  * @return {?}
1664
1818
  */
1665
1819
  FocusTrap.prototype._getLastTabbableElement = /**
1666
1820
  * Get the last tabbable element from a DOM subtree (inclusive).
1821
+ * @private
1667
1822
  * @param {?} root
1668
1823
  * @return {?}
1669
1824
  */
@@ -1671,12 +1826,13 @@ FocusTrap = /** @class */ (function () {
1671
1826
  if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) {
1672
1827
  return root;
1673
1828
  }
1829
+ // Iterate in reverse DOM order.
1674
1830
  /** @type {?} */
1675
1831
  var children = root.children || root.childNodes;
1676
1832
  for (var i = children.length - 1; i >= 0; i--) {
1677
1833
  /** @type {?} */
1678
1834
  var tabbableChild = children[i].nodeType === this._document.ELEMENT_NODE ?
1679
- this._getLastTabbableElement(/** @type {?} */ (children[i])) :
1835
+ this._getLastTabbableElement((/** @type {?} */ (children[i]))) :
1680
1836
  null;
1681
1837
  if (tabbableChild) {
1682
1838
  return tabbableChild;
@@ -1684,12 +1840,15 @@ FocusTrap = /** @class */ (function () {
1684
1840
  }
1685
1841
  return null;
1686
1842
  };
1843
+ /** Creates an anchor element. */
1687
1844
  /**
1688
1845
  * Creates an anchor element.
1846
+ * @private
1689
1847
  * @return {?}
1690
1848
  */
1691
1849
  FocusTrap.prototype._createAnchor = /**
1692
1850
  * Creates an anchor element.
1851
+ * @private
1693
1852
  * @return {?}
1694
1853
  */
1695
1854
  function () {
@@ -1702,12 +1861,19 @@ FocusTrap = /** @class */ (function () {
1702
1861
  };
1703
1862
  /**
1704
1863
  * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
1864
+ * @param isEnabled Whether the focus trap is enabled.
1865
+ * @param anchor Anchor on which to toggle the tabindex.
1866
+ */
1867
+ /**
1868
+ * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
1869
+ * @private
1705
1870
  * @param {?} isEnabled Whether the focus trap is enabled.
1706
1871
  * @param {?} anchor Anchor on which to toggle the tabindex.
1707
1872
  * @return {?}
1708
1873
  */
1709
1874
  FocusTrap.prototype._toggleAnchorTabIndex = /**
1710
1875
  * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
1876
+ * @private
1711
1877
  * @param {?} isEnabled Whether the focus trap is enabled.
1712
1878
  * @param {?} anchor Anchor on which to toggle the tabindex.
1713
1879
  * @return {?}
@@ -1717,13 +1883,16 @@ FocusTrap = /** @class */ (function () {
1717
1883
  // element has a tabindex, the user might still hit it when navigating with the arrow keys.
1718
1884
  isEnabled ? anchor.setAttribute('tabindex', '0') : anchor.removeAttribute('tabindex');
1719
1885
  };
1886
+ /** Executes a function when the zone is stable. */
1720
1887
  /**
1721
1888
  * Executes a function when the zone is stable.
1889
+ * @private
1722
1890
  * @param {?} fn
1723
1891
  * @return {?}
1724
1892
  */
1725
1893
  FocusTrap.prototype._executeOnStable = /**
1726
1894
  * Executes a function when the zone is stable.
1895
+ * @private
1727
1896
  * @param {?} fn
1728
1897
  * @return {?}
1729
1898
  */
@@ -1855,7 +2024,7 @@ var CdkTrapFocus = /** @class */ (function () {
1855
2024
  function () {
1856
2025
  this.focusTrap.attachAnchors();
1857
2026
  if (this.autoCapture) {
1858
- this._previouslyFocusedElement = /** @type {?} */ (this._document.activeElement);
2027
+ this._previouslyFocusedElement = (/** @type {?} */ (this._document.activeElement));
1859
2028
  this.focusTrap.focusInitialElementWhenReady();
1860
2029
  }
1861
2030
  };
@@ -1891,8 +2060,10 @@ var CdkTrapFocus = /** @class */ (function () {
1891
2060
 
1892
2061
  /**
1893
2062
  * @fileoverview added by tsickle
1894
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2063
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1895
2064
  */
2065
+ // The token for the live announcer element is defined in a separate file from LiveAnnouncer
2066
+ // as a workaround for https://github.com/angular/angular/issues/22559
1896
2067
  /** @type {?} */
1897
2068
  var LIVE_ANNOUNCER_ELEMENT_TOKEN = new core.InjectionToken('liveAnnouncerElement', {
1898
2069
  providedIn: 'root',
@@ -1908,7 +2079,7 @@ function LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY() {
1908
2079
 
1909
2080
  /**
1910
2081
  * @fileoverview added by tsickle
1911
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2082
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1912
2083
  */
1913
2084
  var LiveAnnouncer = /** @class */ (function () {
1914
2085
  function LiveAnnouncer(elementToken, _ngZone, _document) {
@@ -1920,29 +2091,35 @@ var LiveAnnouncer = /** @class */ (function () {
1920
2091
  this._liveElement = elementToken || this._createLiveElement();
1921
2092
  }
1922
2093
  /**
1923
- * Announces a message to screenreaders.
1924
- * @param message Message to be announced to the screenreader
1925
- * @param politeness The politeness of the announcer element
1926
- * @returns Promise that will be resolved when the message is added to the DOM.
1927
- */
1928
- /**
1929
- * Announces a message to screenreaders.
1930
- * @param {?} message Message to be announced to the screenreader
1931
- * @param {?=} politeness The politeness of the announcer element
1932
- * @return {?} Promise that will be resolved when the message is added to the DOM.
2094
+ * @param {?} message
2095
+ * @param {...?} args
2096
+ * @return {?}
1933
2097
  */
1934
2098
  LiveAnnouncer.prototype.announce = /**
1935
- * Announces a message to screenreaders.
1936
- * @param {?} message Message to be announced to the screenreader
1937
- * @param {?=} politeness The politeness of the announcer element
1938
- * @return {?} Promise that will be resolved when the message is added to the DOM.
2099
+ * @param {?} message
2100
+ * @param {...?} args
2101
+ * @return {?}
1939
2102
  */
1940
- function (message, politeness) {
2103
+ function (message) {
1941
2104
  var _this = this;
1942
- if (politeness === void 0) { politeness = 'polite'; }
1943
- this._liveElement.textContent = '';
2105
+ var args = [];
2106
+ for (var _i = 1; _i < arguments.length; _i++) {
2107
+ args[_i - 1] = arguments[_i];
2108
+ }
2109
+ /** @type {?} */
2110
+ var politeness;
2111
+ /** @type {?} */
2112
+ var duration;
2113
+ if (args.length === 1 && typeof args[0] === 'number') {
2114
+ duration = args[0];
2115
+ }
2116
+ else {
2117
+ politeness = args[0], duration = args[1];
2118
+ }
2119
+ this.clear();
2120
+ clearTimeout(this._previousTimeout);
1944
2121
  // TODO: ensure changing the politeness works on all environments we support.
1945
- this._liveElement.setAttribute('aria-live', politeness);
2122
+ this._liveElement.setAttribute('aria-live', (/** @type {?} */ (politeness)) || 'polite');
1946
2123
  // This 100ms timeout is necessary for some browser + screen-reader combinations:
1947
2124
  // - Both JAWS and NVDA over IE11 will not announce anything without a non-zero timeout.
1948
2125
  // - With Chrome and IE11 with NVDA or JAWS, a repeated (identical) message won't be read a
@@ -1950,13 +2127,39 @@ var LiveAnnouncer = /** @class */ (function () {
1950
2127
  // (using JAWS 17 at time of this writing).
1951
2128
  return this._ngZone.runOutsideAngular(function () {
1952
2129
  return new Promise(function (resolve) {
1953
- setTimeout(function () {
2130
+ clearTimeout(_this._previousTimeout);
2131
+ _this._previousTimeout = setTimeout(function () {
1954
2132
  _this._liveElement.textContent = message;
1955
2133
  resolve();
2134
+ if (typeof duration === 'number') {
2135
+ _this._previousTimeout = setTimeout(function () { return _this.clear(); }, duration);
2136
+ }
1956
2137
  }, 100);
1957
2138
  });
1958
2139
  });
1959
2140
  };
2141
+ /**
2142
+ * Clears the current text from the announcer element. Can be used to prevent
2143
+ * screen readers from reading the text out again while the user is going
2144
+ * through the page landmarks.
2145
+ */
2146
+ /**
2147
+ * Clears the current text from the announcer element. Can be used to prevent
2148
+ * screen readers from reading the text out again while the user is going
2149
+ * through the page landmarks.
2150
+ * @return {?}
2151
+ */
2152
+ LiveAnnouncer.prototype.clear = /**
2153
+ * Clears the current text from the announcer element. Can be used to prevent
2154
+ * screen readers from reading the text out again while the user is going
2155
+ * through the page landmarks.
2156
+ * @return {?}
2157
+ */
2158
+ function () {
2159
+ if (this._liveElement) {
2160
+ this._liveElement.textContent = '';
2161
+ }
2162
+ };
1960
2163
  /**
1961
2164
  * @return {?}
1962
2165
  */
@@ -1964,14 +2167,18 @@ var LiveAnnouncer = /** @class */ (function () {
1964
2167
  * @return {?}
1965
2168
  */
1966
2169
  function () {
2170
+ clearTimeout(this._previousTimeout);
1967
2171
  if (this._liveElement && this._liveElement.parentNode) {
1968
2172
  this._liveElement.parentNode.removeChild(this._liveElement);
2173
+ this._liveElement = (/** @type {?} */ (null));
1969
2174
  }
1970
2175
  };
1971
2176
  /**
2177
+ * @private
1972
2178
  * @return {?}
1973
2179
  */
1974
2180
  LiveAnnouncer.prototype._createLiveElement = /**
2181
+ * @private
1975
2182
  * @return {?}
1976
2183
  */
1977
2184
  function () {
@@ -1983,7 +2190,7 @@ var LiveAnnouncer = /** @class */ (function () {
1983
2190
  var liveEl = this._document.createElement('div');
1984
2191
  // Remove any old containers. This can happen when coming in from a server-side-rendered page.
1985
2192
  for (var i = 0; i < previousElements.length; i++) {
1986
- /** @type {?} */ ((previousElements[i].parentNode)).removeChild(previousElements[i]);
2193
+ (/** @type {?} */ (previousElements[i].parentNode)).removeChild(previousElements[i]);
1987
2194
  }
1988
2195
  liveEl.classList.add(elementClass);
1989
2196
  liveEl.classList.add('cdk-visually-hidden');
@@ -2041,9 +2248,15 @@ var CdkAriaLive = /** @class */ (function () {
2041
2248
  return _this._contentObserver
2042
2249
  .observe(_this._elementRef)
2043
2250
  .subscribe(function () {
2251
+ // Note that we use textContent here, rather than innerText, in order to avoid a reflow.
2044
2252
  /** @type {?} */
2045
- var element = _this._elementRef.nativeElement;
2046
- _this._liveAnnouncer.announce(element.textContent, _this._politeness);
2253
+ var elementText = _this._elementRef.nativeElement.textContent;
2254
+ // The `MutationObserver` fires also for attribute
2255
+ // changes which we don't want to announce.
2256
+ if (elementText !== _this._previousAnnouncedText) {
2257
+ _this._liveAnnouncer.announce(elementText, _this._politeness);
2258
+ _this._previousAnnouncedText = elementText;
2259
+ }
2047
2260
  });
2048
2261
  });
2049
2262
  }
@@ -2082,18 +2295,19 @@ var CdkAriaLive = /** @class */ (function () {
2082
2295
  }());
2083
2296
  /**
2084
2297
  * \@docs-private \@deprecated \@breaking-change 8.0.0
2085
- * @param {?} parentDispatcher
2298
+ * @param {?} parentAnnouncer
2086
2299
  * @param {?} liveElement
2087
2300
  * @param {?} _document
2088
2301
  * @param {?} ngZone
2089
2302
  * @return {?}
2090
2303
  */
2091
- function LIVE_ANNOUNCER_PROVIDER_FACTORY(parentDispatcher, liveElement, _document, ngZone) {
2092
- return parentDispatcher || new LiveAnnouncer(liveElement, _document, ngZone);
2304
+ function LIVE_ANNOUNCER_PROVIDER_FACTORY(parentAnnouncer, liveElement, _document, ngZone) {
2305
+ return parentAnnouncer || new LiveAnnouncer(liveElement, ngZone, _document);
2093
2306
  }
2094
- /** *
2307
+ /**
2095
2308
  * \@docs-private \@deprecated \@breaking-change 8.0.0
2096
- @type {?} */
2309
+ * @type {?}
2310
+ */
2097
2311
  var LIVE_ANNOUNCER_PROVIDER = {
2098
2312
  // If there is already a LiveAnnouncer available, use that. Otherwise, provide a new one.
2099
2313
  provide: LiveAnnouncer,
@@ -2108,15 +2322,27 @@ var LIVE_ANNOUNCER_PROVIDER = {
2108
2322
 
2109
2323
  /**
2110
2324
  * @fileoverview added by tsickle
2111
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2325
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2112
2326
  */
2327
+ // This is the value used by AngularJS Material. Through trial and error (on iPhone 6S) they found
2328
+ // that a value of around 650ms seems appropriate.
2113
2329
  /** @type {?} */
2114
2330
  var TOUCH_BUFFER_MS = 650;
2331
+ /**
2332
+ * Event listener options that enable capturing and also
2333
+ * mark the the listener as passive if the browser supports it.
2334
+ * @type {?}
2335
+ */
2336
+ var captureEventListenerOptions = platform.normalizePassiveListenerOptions({
2337
+ passive: true,
2338
+ capture: true
2339
+ });
2115
2340
  /**
2116
2341
  * Monitors mouse and keyboard events to determine the cause of focus events.
2117
2342
  */
2118
2343
  var FocusMonitor = /** @class */ (function () {
2119
2344
  function FocusMonitor(_ngZone, _platform) {
2345
+ var _this = this;
2120
2346
  this._ngZone = _ngZone;
2121
2347
  this._platform = _platform;
2122
2348
  /**
@@ -2131,14 +2357,54 @@ var FocusMonitor = /** @class */ (function () {
2131
2357
  * Map of elements being monitored to their info.
2132
2358
  */
2133
2359
  this._elementInfo = new Map();
2134
- /**
2135
- * A map of global objects to lists of current listeners.
2136
- */
2137
- this._unregisterGlobalListeners = function () { };
2138
2360
  /**
2139
2361
  * The number of elements currently being monitored.
2140
2362
  */
2141
2363
  this._monitoredElementCount = 0;
2364
+ /**
2365
+ * Event listener for `keydown` events on the document.
2366
+ * Needs to be an arrow function in order to preserve the context when it gets bound.
2367
+ */
2368
+ this._documentKeydownListener = function () {
2369
+ // On keydown record the origin and clear any touch event that may be in progress.
2370
+ _this._lastTouchTarget = null;
2371
+ _this._setOriginForCurrentEventQueue('keyboard');
2372
+ };
2373
+ /**
2374
+ * Event listener for `mousedown` events on the document.
2375
+ * Needs to be an arrow function in order to preserve the context when it gets bound.
2376
+ */
2377
+ this._documentMousedownListener = function () {
2378
+ // On mousedown record the origin only if there is not touch
2379
+ // target, since a mousedown can happen as a result of a touch event.
2380
+ if (!_this._lastTouchTarget) {
2381
+ _this._setOriginForCurrentEventQueue('mouse');
2382
+ }
2383
+ };
2384
+ /**
2385
+ * Event listener for `touchstart` events on the document.
2386
+ * Needs to be an arrow function in order to preserve the context when it gets bound.
2387
+ */
2388
+ this._documentTouchstartListener = function (event) {
2389
+ // When the touchstart event fires the focus event is not yet in the event queue. This means
2390
+ // we can't rely on the trick used above (setting timeout of 1ms). Instead we wait 650ms to
2391
+ // see if a focus happens.
2392
+ if (_this._touchTimeoutId != null) {
2393
+ clearTimeout(_this._touchTimeoutId);
2394
+ }
2395
+ _this._lastTouchTarget = event.target;
2396
+ _this._touchTimeoutId = setTimeout(function () { return _this._lastTouchTarget = null; }, TOUCH_BUFFER_MS);
2397
+ };
2398
+ /**
2399
+ * Event listener for `focus` events on the window.
2400
+ * Needs to be an arrow function in order to preserve the context when it gets bound.
2401
+ */
2402
+ this._windowFocusListener = function () {
2403
+ // Make a note of when the window regains focus, so we can
2404
+ // restore the origin info for the focused element.
2405
+ _this._windowFocused = true;
2406
+ _this._windowFocusTimeoutId = setTimeout(function () { return _this._windowFocused = false; });
2407
+ };
2142
2408
  }
2143
2409
  /**
2144
2410
  * @param {?} element
@@ -2162,10 +2428,11 @@ var FocusMonitor = /** @class */ (function () {
2162
2428
  // Check if we're already monitoring this element.
2163
2429
  if (this._elementInfo.has(nativeElement)) {
2164
2430
  /** @type {?} */
2165
- var cachedInfo = this._elementInfo.get(nativeElement); /** @type {?} */
2166
- ((cachedInfo)).checkChildren = checkChildren;
2167
- return /** @type {?} */ ((cachedInfo)).subject.asObservable();
2431
+ var cachedInfo = this._elementInfo.get(nativeElement);
2432
+ (/** @type {?} */ (cachedInfo)).checkChildren = checkChildren;
2433
+ return (/** @type {?} */ (cachedInfo)).subject.asObservable();
2168
2434
  }
2435
+ // Create monitored element info.
2169
2436
  /** @type {?} */
2170
2437
  var info = {
2171
2438
  unlisten: function () { },
@@ -2174,6 +2441,7 @@ var FocusMonitor = /** @class */ (function () {
2174
2441
  };
2175
2442
  this._elementInfo.set(nativeElement, info);
2176
2443
  this._incrementMonitoredElementCount();
2444
+ // Start listening. We need to listen in capture phase since focus events don't bubble.
2177
2445
  /** @type {?} */
2178
2446
  var focusListener = function (event) { return _this._onFocus(event, nativeElement); };
2179
2447
  /** @type {?} */
@@ -2229,7 +2497,7 @@ var FocusMonitor = /** @class */ (function () {
2229
2497
  // `focus` isn't available on the server
2230
2498
  if (typeof nativeElement.focus === 'function') {
2231
2499
  // Cast the element to `any`, because the TS typings don't have the `options` parameter yet.
2232
- (/** @type {?} */ (nativeElement)).focus(options);
2500
+ ((/** @type {?} */ (nativeElement))).focus(options);
2233
2501
  }
2234
2502
  };
2235
2503
  /**
@@ -2243,74 +2511,14 @@ var FocusMonitor = /** @class */ (function () {
2243
2511
  this._elementInfo.forEach(function (_info, element) { return _this.stopMonitoring(element); });
2244
2512
  };
2245
2513
  /**
2246
- * Register necessary event listeners on the document and window.
2247
- * @return {?}
2248
- */
2249
- FocusMonitor.prototype._registerGlobalListeners = /**
2250
- * Register necessary event listeners on the document and window.
2251
- * @return {?}
2252
- */
2253
- function () {
2254
- var _this = this;
2255
- // Do nothing if we're not on the browser platform.
2256
- if (!this._platform.isBrowser) {
2257
- return;
2258
- }
2259
- /** @type {?} */
2260
- var documentKeydownListener = function () {
2261
- _this._lastTouchTarget = null;
2262
- _this._setOriginForCurrentEventQueue('keyboard');
2263
- };
2264
- /** @type {?} */
2265
- var documentMousedownListener = function () {
2266
- if (!_this._lastTouchTarget) {
2267
- _this._setOriginForCurrentEventQueue('mouse');
2268
- }
2269
- };
2270
- /** @type {?} */
2271
- var documentTouchstartListener = function (event) {
2272
- if (_this._touchTimeoutId != null) {
2273
- clearTimeout(_this._touchTimeoutId);
2274
- }
2275
- _this._lastTouchTarget = event.target;
2276
- _this._touchTimeoutId = setTimeout(function () { return _this._lastTouchTarget = null; }, TOUCH_BUFFER_MS);
2277
- };
2278
- /** @type {?} */
2279
- var windowFocusListener = function () {
2280
- _this._windowFocused = true;
2281
- _this._windowFocusTimeoutId = setTimeout(function () { return _this._windowFocused = false; });
2282
- };
2283
- /** @type {?} */
2284
- var captureEventListenerOptions = platform.normalizePassiveListenerOptions({
2285
- passive: true,
2286
- capture: true
2287
- });
2288
- // Note: we listen to events in the capture phase so we can detect them even if the user stops
2289
- // propagation.
2290
- this._ngZone.runOutsideAngular(function () {
2291
- document.addEventListener('keydown', documentKeydownListener, captureEventListenerOptions);
2292
- document.addEventListener('mousedown', documentMousedownListener, captureEventListenerOptions);
2293
- document.addEventListener('touchstart', documentTouchstartListener, captureEventListenerOptions);
2294
- window.addEventListener('focus', windowFocusListener);
2295
- });
2296
- this._unregisterGlobalListeners = function () {
2297
- document.removeEventListener('keydown', documentKeydownListener, captureEventListenerOptions);
2298
- document.removeEventListener('mousedown', documentMousedownListener, captureEventListenerOptions);
2299
- document.removeEventListener('touchstart', documentTouchstartListener, captureEventListenerOptions);
2300
- window.removeEventListener('focus', windowFocusListener);
2301
- // Clear timeouts for all potentially pending timeouts to prevent the leaks.
2302
- clearTimeout(_this._windowFocusTimeoutId);
2303
- clearTimeout(_this._touchTimeoutId);
2304
- clearTimeout(_this._originTimeoutId);
2305
- };
2306
- };
2307
- /**
2514
+ * @private
2308
2515
  * @param {?} element
2309
2516
  * @param {?} className
2310
2517
  * @param {?} shouldSet
2311
2518
  * @return {?}
2312
2519
  */
2313
2520
  FocusMonitor.prototype._toggleClass = /**
2521
+ * @private
2314
2522
  * @param {?} element
2315
2523
  * @param {?} className
2316
2524
  * @param {?} shouldSet
@@ -2326,12 +2534,19 @@ var FocusMonitor = /** @class */ (function () {
2326
2534
  };
2327
2535
  /**
2328
2536
  * Sets the focus classes on the element based on the given focus origin.
2537
+ * @param element The element to update the classes on.
2538
+ * @param origin The focus origin.
2539
+ */
2540
+ /**
2541
+ * Sets the focus classes on the element based on the given focus origin.
2542
+ * @private
2329
2543
  * @param {?} element The element to update the classes on.
2330
2544
  * @param {?=} origin The focus origin.
2331
2545
  * @return {?}
2332
2546
  */
2333
2547
  FocusMonitor.prototype._setClasses = /**
2334
2548
  * Sets the focus classes on the element based on the given focus origin.
2549
+ * @private
2335
2550
  * @param {?} element The element to update the classes on.
2336
2551
  * @param {?=} origin The focus origin.
2337
2552
  * @return {?}
@@ -2349,11 +2564,17 @@ var FocusMonitor = /** @class */ (function () {
2349
2564
  };
2350
2565
  /**
2351
2566
  * Sets the origin and schedules an async function to clear it at the end of the event queue.
2567
+ * @param origin The origin to set.
2568
+ */
2569
+ /**
2570
+ * Sets the origin and schedules an async function to clear it at the end of the event queue.
2571
+ * @private
2352
2572
  * @param {?} origin The origin to set.
2353
2573
  * @return {?}
2354
2574
  */
2355
2575
  FocusMonitor.prototype._setOriginForCurrentEventQueue = /**
2356
2576
  * Sets the origin and schedules an async function to clear it at the end of the event queue.
2577
+ * @private
2357
2578
  * @param {?} origin The origin to set.
2358
2579
  * @return {?}
2359
2580
  */
@@ -2369,15 +2590,39 @@ var FocusMonitor = /** @class */ (function () {
2369
2590
  };
2370
2591
  /**
2371
2592
  * Checks whether the given focus event was caused by a touchstart event.
2593
+ * @param event The focus event to check.
2594
+ * @returns Whether the event was caused by a touch.
2595
+ */
2596
+ /**
2597
+ * Checks whether the given focus event was caused by a touchstart event.
2598
+ * @private
2372
2599
  * @param {?} event The focus event to check.
2373
2600
  * @return {?} Whether the event was caused by a touch.
2374
2601
  */
2375
2602
  FocusMonitor.prototype._wasCausedByTouch = /**
2376
2603
  * Checks whether the given focus event was caused by a touchstart event.
2604
+ * @private
2377
2605
  * @param {?} event The focus event to check.
2378
2606
  * @return {?} Whether the event was caused by a touch.
2379
2607
  */
2380
2608
  function (event) {
2609
+ // Note(mmalerba): This implementation is not quite perfect, there is a small edge case.
2610
+ // Consider the following dom structure:
2611
+ //
2612
+ // <div #parent tabindex="0" cdkFocusClasses>
2613
+ // <div #child (click)="#parent.focus()"></div>
2614
+ // </div>
2615
+ //
2616
+ // If the user touches the #child element and the #parent is programmatically focused as a
2617
+ // result, this code will still consider it to have been caused by the touch event and will
2618
+ // apply the cdk-touch-focused class rather than the cdk-program-focused class. This is a
2619
+ // relatively small edge-case that can be worked around by using
2620
+ // focusVia(parentEl, 'program') to focus the parent element.
2621
+ //
2622
+ // If we decide that we absolutely must handle this case correctly, we can do so by listening
2623
+ // for the first focus event after the touchstart, and then the first blur event after that
2624
+ // focus event. When that blur event fires we know that whatever follows is not a result of the
2625
+ // touchstart.
2381
2626
  /** @type {?} */
2382
2627
  var focusTarget = event.target;
2383
2628
  return this._lastTouchTarget instanceof Node && focusTarget instanceof Node &&
@@ -2385,22 +2630,45 @@ var FocusMonitor = /** @class */ (function () {
2385
2630
  };
2386
2631
  /**
2387
2632
  * Handles focus events on a registered element.
2633
+ * @param event The focus event.
2634
+ * @param element The monitored element.
2635
+ */
2636
+ /**
2637
+ * Handles focus events on a registered element.
2638
+ * @private
2388
2639
  * @param {?} event The focus event.
2389
2640
  * @param {?} element The monitored element.
2390
2641
  * @return {?}
2391
2642
  */
2392
2643
  FocusMonitor.prototype._onFocus = /**
2393
2644
  * Handles focus events on a registered element.
2645
+ * @private
2394
2646
  * @param {?} event The focus event.
2395
2647
  * @param {?} element The monitored element.
2396
2648
  * @return {?}
2397
2649
  */
2398
2650
  function (event, element) {
2651
+ // NOTE(mmalerba): We currently set the classes based on the focus origin of the most recent
2652
+ // focus event affecting the monitored element. If we want to use the origin of the first event
2653
+ // instead we should check for the cdk-focused class here and return if the element already has
2654
+ // it. (This only matters for elements that have includesChildren = true).
2655
+ // NOTE(mmalerba): We currently set the classes based on the focus origin of the most recent
2656
+ // focus event affecting the monitored element. If we want to use the origin of the first event
2657
+ // instead we should check for the cdk-focused class here and return if the element already has
2658
+ // it. (This only matters for elements that have includesChildren = true).
2659
+ // If we are not counting child-element-focus as focused, make sure that the event target is the
2660
+ // monitored element itself.
2399
2661
  /** @type {?} */
2400
2662
  var elementInfo = this._elementInfo.get(element);
2401
2663
  if (!elementInfo || (!elementInfo.checkChildren && element !== event.target)) {
2402
2664
  return;
2403
2665
  }
2666
+ // If we couldn't detect a cause for the focus event, it's due to one of three reasons:
2667
+ // 1) The window has just regained focus, in which case we want to restore the focused state of
2668
+ // the element from before the window blurred.
2669
+ // 2) It was caused by a touch event, in which case we mark the origin as 'touch'.
2670
+ // 3) The element was programmatically focused, in which case we should mark the origin as
2671
+ // 'program'.
2404
2672
  /** @type {?} */
2405
2673
  var origin = this._origin;
2406
2674
  if (!origin) {
@@ -2436,6 +2704,8 @@ var FocusMonitor = /** @class */ (function () {
2436
2704
  * @return {?}
2437
2705
  */
2438
2706
  function (event, element) {
2707
+ // If we are counting child-element-focus as focused, make sure that we aren't just blurring in
2708
+ // order to focus another child of the monitored element.
2439
2709
  /** @type {?} */
2440
2710
  var elementInfo = this._elementInfo.get(element);
2441
2711
  if (!elementInfo || (elementInfo.checkChildren && event.relatedTarget instanceof Node &&
@@ -2446,11 +2716,13 @@ var FocusMonitor = /** @class */ (function () {
2446
2716
  this._emitOrigin(elementInfo.subject, null);
2447
2717
  };
2448
2718
  /**
2719
+ * @private
2449
2720
  * @param {?} subject
2450
2721
  * @param {?} origin
2451
2722
  * @return {?}
2452
2723
  */
2453
2724
  FocusMonitor.prototype._emitOrigin = /**
2725
+ * @private
2454
2726
  * @param {?} subject
2455
2727
  * @param {?} origin
2456
2728
  * @return {?}
@@ -2459,35 +2731,55 @@ var FocusMonitor = /** @class */ (function () {
2459
2731
  this._ngZone.run(function () { return subject.next(origin); });
2460
2732
  };
2461
2733
  /**
2734
+ * @private
2462
2735
  * @return {?}
2463
2736
  */
2464
2737
  FocusMonitor.prototype._incrementMonitoredElementCount = /**
2738
+ * @private
2465
2739
  * @return {?}
2466
2740
  */
2467
2741
  function () {
2742
+ var _this = this;
2468
2743
  // Register global listeners when first element is monitored.
2469
- if (++this._monitoredElementCount == 1) {
2470
- this._registerGlobalListeners();
2744
+ if (++this._monitoredElementCount == 1 && this._platform.isBrowser) {
2745
+ // Note: we listen to events in the capture phase so we
2746
+ // can detect them even if the user stops propagation.
2747
+ this._ngZone.runOutsideAngular(function () {
2748
+ document.addEventListener('keydown', _this._documentKeydownListener, captureEventListenerOptions);
2749
+ document.addEventListener('mousedown', _this._documentMousedownListener, captureEventListenerOptions);
2750
+ document.addEventListener('touchstart', _this._documentTouchstartListener, captureEventListenerOptions);
2751
+ window.addEventListener('focus', _this._windowFocusListener);
2752
+ });
2471
2753
  }
2472
2754
  };
2473
2755
  /**
2756
+ * @private
2474
2757
  * @return {?}
2475
2758
  */
2476
2759
  FocusMonitor.prototype._decrementMonitoredElementCount = /**
2760
+ * @private
2477
2761
  * @return {?}
2478
2762
  */
2479
2763
  function () {
2480
2764
  // Unregister global listeners when last element is unmonitored.
2481
2765
  if (!--this._monitoredElementCount) {
2482
- this._unregisterGlobalListeners();
2483
- this._unregisterGlobalListeners = function () { };
2766
+ document.removeEventListener('keydown', this._documentKeydownListener, captureEventListenerOptions);
2767
+ document.removeEventListener('mousedown', this._documentMousedownListener, captureEventListenerOptions);
2768
+ document.removeEventListener('touchstart', this._documentTouchstartListener, captureEventListenerOptions);
2769
+ window.removeEventListener('focus', this._windowFocusListener);
2770
+ // Clear timeouts for all potentially pending timeouts to prevent the leaks.
2771
+ clearTimeout(this._windowFocusTimeoutId);
2772
+ clearTimeout(this._touchTimeoutId);
2773
+ clearTimeout(this._originTimeoutId);
2484
2774
  }
2485
2775
  };
2486
2776
  /**
2777
+ * @private
2487
2778
  * @param {?} element
2488
2779
  * @return {?}
2489
2780
  */
2490
2781
  FocusMonitor.prototype._getNativeElement = /**
2782
+ * @private
2491
2783
  * @param {?} element
2492
2784
  * @return {?}
2493
2785
  */
@@ -2558,9 +2850,10 @@ var CdkMonitorFocus = /** @class */ (function () {
2558
2850
  function FOCUS_MONITOR_PROVIDER_FACTORY(parentDispatcher, ngZone, platform$$1) {
2559
2851
  return parentDispatcher || new FocusMonitor(ngZone, platform$$1);
2560
2852
  }
2561
- /** *
2853
+ /**
2562
2854
  * \@docs-private \@deprecated \@breaking-change 8.0.0
2563
- @type {?} */
2855
+ * @type {?}
2856
+ */
2564
2857
  var FOCUS_MONITOR_PROVIDER = {
2565
2858
  // If there is already a FocusMonitor available, use that. Otherwise, provide a new one.
2566
2859
  provide: FocusMonitor,
@@ -2570,7 +2863,7 @@ var FOCUS_MONITOR_PROVIDER = {
2570
2863
 
2571
2864
  /**
2572
2865
  * @fileoverview added by tsickle
2573
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2866
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2574
2867
  */
2575
2868
 
2576
2869
  /**
@@ -2588,7 +2881,7 @@ function isFakeMousedownFromScreenReader(event) {
2588
2881
 
2589
2882
  /**
2590
2883
  * @fileoverview added by tsickle
2591
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2884
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2592
2885
  */
2593
2886
  var A11yModule = /** @class */ (function () {
2594
2887
  function A11yModule() {