* Highlights the selected item. If no option is selected, it will highlight * the first *enabled* option.
()
| 1297 | * the first *enabled* option. |
| 1298 | */ |
| 1299 | private _highlightCorrectOption(): void { |
| 1300 | if (this._keyManager) { |
| 1301 | if (this.empty) { |
| 1302 | // Find the index of the first *enabled* option. Avoid calling `_keyManager.setActiveItem` |
| 1303 | // because it activates the first option that passes the skip predicate, rather than the |
| 1304 | // first *enabled* option. |
| 1305 | let firstEnabledOptionIndex = -1; |
| 1306 | for (let index = 0; index < this.options.length; index++) { |
| 1307 | const option = this.options.get(index)!; |
| 1308 | if (!option.disabled) { |
| 1309 | firstEnabledOptionIndex = index; |
| 1310 | break; |
| 1311 | } |
| 1312 | } |
| 1313 | |
| 1314 | this._keyManager.setActiveItem(firstEnabledOptionIndex); |
| 1315 | } else { |
| 1316 | this._keyManager.setActiveItem(this._selectionModel.selected[0]); |
| 1317 | } |
| 1318 | } |
| 1319 | } |
| 1320 | |
| 1321 | /** Whether the panel is allowed to open. */ |
| 1322 | protected _canOpen(): boolean { |
no test coverage detected