Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mounted () {
this.focusTrap_ = createFocusTrapInstance(this.$refs.surface, this.$refs.accept)
this.foundation = new MDCDialogFoundation({
addClass: (className) => this.$el.classList.add(className),
removeClass: (className) => this.$el.classList.remove(className),
addBodyClass: (className) => document.body.classList.add(className),
removeBodyClass: (className) => document.body.classList.remove(className),
eventTargetHasClass: (target, className) => target.classList.contains(className),
registerInteractionHandler: (evt, handler) => this.$el.addEventListener(evt, handler),
deregisterInteractionHandler: (evt, handler) => this.$el.removeEventListener(evt, handler),
registerSurfaceInteractionHandler: (evt, handler) => this.$refs.surface.addEventListener(evt, handler),
deregisterSurfaceInteractionHandler: (evt, handler) => this.$refs.surface.removeEventListener(evt, handler),
registerDocumentKeydownHandler: (handler) => document.addEventListener('keydown', handler),
deregisterDocumentKeydownHandler: (handler) => document.removeEventListener('keydown', handler),
registerTransitionEndHandler: (handler) => this.$refs.surface.addEventListener('transitionend', handler),
deregisterTransitionEndHandler: (handler) => this.$refs.surface.removeEventListener('transitionend', handler),
notifyAccept: () => this.$emit('accepted'),
notifyCancel: () => this.$emit('canceled'),
private initializeFocusTrap = (): void => {
this.focusTrap = this.props.children && createFocusTrapInstance(this.dialogElement.current!);
};
onOpen_(value) {
if (value) {
if (this.$refs.container) {
this.focusTrap = util.createFocusTrapInstance(
this.$el,
void 0,
this.getInitialFocusEl_() || void 0,
);
}
this.foundation.open();
} else {
this.foundation.close();
}
},
onCancel() {
onOpen_(value) {
if (value) {
if (this.$refs.container) {
this.focusTrap = util.createFocusTrapInstance(
this.$el,
createFocusTrap,
);
}
this.foundation.open();
} else {
this.foundation.close();
}
},