File

core/select/select-keyboard.service.ts

Description

This service provides keyboard navigation for dropdowns.

It allows to navigate over the items in the dropdown using the keyboard or search for them. For this to correctly work, the service needs to provided as component provider in the component. Additionally the ListItemComponent needs to be used in the dropdown items. Also each item needs to have a span[data-search-label] element to search for the item.

Index

Properties
Methods

Methods

isSelectionEvent
isSelectionEvent(event: KeyboardEvent)

Returns true if the keyboard event is fired by a selection event (Enter, Down, Tab, Up, Space)

Parameters :
Name Type Optional
event KeyboardEvent No
Returns : boolean

true if the event is a selection event.

ngOnDestroy
ngOnDestroy()
Returns : void
register$
register$(input: HTMLInputElement, list: QueryList<ListItemComponent>, dropdown: BsDropdownDirective)

Registers the keyboard event listener for the dropdown.

Parameters :
Name Type Optional Description
input HTMLInputElement No

The input element to search for items.

list QueryList<ListItemComponent> No

A QueryList of all the [ListItemComponent] on which can be searched

dropdown BsDropdownDirective No

The dropdown itself as [BsDropdownDirective].

Returns : Observable<number>

A Observable where number is the index of the selected [ListItemComponent]

unregister
unregister()

Unregister the keyboard event listner.

Returns : void

Properties

options
Type : object
Default value : { /** * If true, the input will be cleared when the user selects an item. */ emptyInput: false, /** * Search on key event. */ keyboardSearch: false }

Conifguration options for the keyboard service.

results matching ""

    No results matching ""