Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (selectedItem) {
selectedItem.focus();
} else {
const cdkInitialItem = this._platform.isBrowser ?
document.querySelector(`[cdkFocusInitial]`) as HTMLElement : null;
if (cdkInitialItem) {
cdkInitialItem.focus();
}
}
},
notifyClose: () => this.closed.emit(),
notifyOpen: () => this.opened.emit(),
trapFocus: () => {},
releaseFocus: () => this._releaseFocus()
};
return this.modal ? new MDCModalDrawerFoundation(adapter) : new MDCDismissibleDrawerFoundation(adapter);
}
initFoundation = () => {
const {dismissible, modal} = this.props;
if (this.foundation_) {
this.foundation_.destroy();
}
if (dismissible) {
this.foundation_ = new MDCDismissibleDrawerFoundation(this.adapter);
this.foundation_.init();
} else if (modal) {
this.initializeFocusTrap();
this.foundation_ = new MDCModalDrawerFoundation(this.adapter);
this.foundation_.init();
}
}
private initFoundation = () => {
const {dismissible, modal} = this.props;
if (this.foundation) {
this.foundation.destroy();
}
if (dismissible) {
this.foundation = new MDCDismissibleDrawerFoundation(this.adapter);
this.foundation.init();
} else if (modal) {
this.initializeFocusTrap();
this.foundation = new MDCModalDrawerFoundation(this.adapter);
this.foundation.init();
}
};