diff --git a/packages/mdc-dialog/index.ts b/packages/mdc-dialog/index.ts index 9bc52b289cd..dce700fb22f 100644 --- a/packages/mdc-dialog/index.ts +++ b/packages/mdc-dialog/index.ts @@ -70,7 +70,7 @@ class MDCDialog extends MDCComponent { private container_!: HTMLElement; // assigned in initialize() private content_!: HTMLElement | null; // assigned in initialize() private defaultButton_!: HTMLElement | null; // assigned in initialize() - private initialFocusEl_!: HTMLElement | undefined; // assigned in initialize() + private initialFocusEl_?: HTMLElement; // assigned in initialize() private focusTrap_!: createFocusTrap.FocusTrap; // assigned in initialSyncWithDOM() private focusTrapFactory_!: FocusTrapFactory; // assigned in initialize() @@ -83,7 +83,7 @@ class MDCDialog extends MDCComponent { initialize( focusTrapFactory: FocusTrapFactory = createFocusTrap as unknown as FocusTrapFactory, - initialFocusEl?: Element) { + initialFocusEl?: HTMLElement) { const container = this.root_.querySelector(strings.CONTAINER_SELECTOR); if (!container) { throw new Error(`Dialog component requires a ${strings.CONTAINER_SELECTOR} container element`); @@ -93,7 +93,7 @@ class MDCDialog extends MDCComponent { this.buttons_ = [].slice.call(this.root_.querySelectorAll(strings.BUTTON_SELECTOR)); this.defaultButton_ = this.root_.querySelector(strings.DEFAULT_BUTTON_SELECTOR); this.focusTrapFactory_ = focusTrapFactory; - this.initialFocusEl_ = initialFocusEl as HTMLElement | undefined; + this.initialFocusEl_ = initialFocusEl; this.buttonRipples_ = []; for (const buttonEl of this.buttons_) { diff --git a/packages/mdc-drawer/types.ts b/packages/mdc-drawer/types.ts index 093fc5b3489..ea4926e68b3 100644 --- a/packages/mdc-drawer/types.ts +++ b/packages/mdc-drawer/types.ts @@ -24,11 +24,9 @@ import {MDCList} from '@material/list/index'; import * as FocusTrapLib from 'focus-trap'; -// TODO(acdvorak): Centralize this in mdc-base or mdc-dom? export type FocusTrapFactory = ( element: HTMLElement | string, userOptions?: FocusTrapLib.Options, ) => FocusTrapLib.FocusTrap; -// TODO(acdvorak): Centralize this in mdc-list (ditto for other packages) export type ListFactory = (el: Element) => MDCList;