MCPcopy Create free account
hub / github.com/angular/components / _handleOptionClicked

Method _handleOptionClicked

src/cdk/listbox/listbox.ts:962–975  ·  view source on GitHub ↗

* Handle the user clicking an option. * @param option The option that was clicked.

(option: CdkOption<T>, event: MouseEvent)

Source from the content-addressed store, hash-verified

960 * @param option The option that was clicked.
961 */
962 private _handleOptionClicked(option: CdkOption<T>, event: MouseEvent) {
963 event.preventDefault();
964 this.listKeyManager.setActiveItem(option);
965 if (event.shiftKey && this.multiple) {
966 this.triggerRange(
967 option,
968 this._getLastTriggeredIndex() ?? this.listKeyManager.activeItemIndex!,
969 this.listKeyManager.activeItemIndex!,
970 !option.isSelected(),
971 );
972 } else {
973 this.triggerOption(option);
974 }
975 }
976
977 /** Verifies that no two options represent the same value under the compareWith function. */
978 private _verifyNoOptionValueCollisions() {

Callers 1

ngAfterContentInitMethod · 0.95

Calls 5

triggerRangeMethod · 0.95
triggerOptionMethod · 0.95
isSelectedMethod · 0.65
setActiveItemMethod · 0.45

Tested by

no test coverage detected