Skip to main content

NgBootstrap: Popover Example

Set focus to element in panel directly after it opens

setFilterPanelFocus() {
setTimeout(function () {
let filterOptionElems = document.querySelectorAll('#phaListingFilterOptions label.filter-option') as NodeListOf<HTMLElement>;

if (filterOptionElems && filterOptionElems.length) {
filterOptionElems[0].focus();
}
}, 0);
}

ngAfterViewChecked() {
if (this.startFilterToggle) {
this.setFilterPanelFocus();
this.startFilterToggle = false;
}
}

filterPanelShown() {
//this.startFilterToggle = true;
}

filterPanelHidden() {
//this.startFilterToggle = true;
}

popover example