Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setTabIndexForListItemChildren: (listItemIndex, tabIndexValue) => {
const listItem = this.listElements[listItemIndex];
const selector =
MDCListFoundation.strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX;
const listItemChildren: Element[] = [].slice.call(
listItem.querySelectorAll(selector)
);
listItemChildren.forEach((el) =>
el.setAttribute('tabindex', tabIndexValue)
);
},
focusItemAtIndex: (index) => {
var _this = this;
this.menuSurface_ = this.menuSurfaceFactory_(this.root_);
var list = this.root_.querySelector(strings.LIST_SELECTOR);
if (list) {
this.list_ = this.listFactory_(list);
this.list_.wrapFocus = true;
}
else {
this.list_ = null;
}
this.handleKeydown_ = function (evt) { return _this.foundation_.handleKeydown(evt); };
this.handleItemAction_ = function (evt) { return _this.foundation_.handleItemAction(_this.items[evt.detail.index]); };
this.handleMenuSurfaceOpened_ = function () { return _this.foundation_.handleMenuSurfaceOpened(); };
this.menuSurface_.listen(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_);
this.listen('keydown', this.handleKeydown_);
this.listen(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_);
};
MDCMenu.prototype.destroy = function () {
get listElements(): Element[] {
if (this.listItemElement.current) {
const listElement = closest(
this.listItemElement.current,
`.${MDCListFoundation.cssClasses.ROOT}`
);
if (!listElement) return [];
return [].slice.call(
listElement.querySelectorAll(
MDCListFoundation.strings.ENABLED_ITEMS_SELECTOR
)
);
}
return [];
}
hasRadioAtIndex: (index) => {
const listItem = this.listElements[index];
return !!listItem.querySelector(
MDCListFoundation.strings.RADIO_SELECTOR
);
},
isCheckboxCheckedAtIndex: (index) => {