Skip to content

Commit

Permalink
WIP: Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
acdvorak committed Feb 14, 2019
1 parent b5a06e5 commit 1cd4d00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/mdc-dialog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class MDCDialog extends MDCComponent<MDCDialogFoundation> {
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()
Expand All @@ -83,7 +83,7 @@ class MDCDialog extends MDCComponent<MDCDialogFoundation> {

initialize(
focusTrapFactory: FocusTrapFactory = createFocusTrap as unknown as FocusTrapFactory,
initialFocusEl?: Element) {
initialFocusEl?: HTMLElement) {
const container = this.root_.querySelector<HTMLElement>(strings.CONTAINER_SELECTOR);
if (!container) {
throw new Error(`Dialog component requires a ${strings.CONTAINER_SELECTOR} container element`);
Expand All @@ -93,7 +93,7 @@ class MDCDialog extends MDCComponent<MDCDialogFoundation> {
this.buttons_ = [].slice.call(this.root_.querySelectorAll<HTMLElement>(strings.BUTTON_SELECTOR));
this.defaultButton_ = this.root_.querySelector<HTMLElement>(strings.DEFAULT_BUTTON_SELECTOR);
this.focusTrapFactory_ = focusTrapFactory;
this.initialFocusEl_ = initialFocusEl as HTMLElement | undefined;
this.initialFocusEl_ = initialFocusEl;
this.buttonRipples_ = [];

for (const buttonEl of this.buttons_) {
Expand Down
2 changes: 0 additions & 2 deletions packages/mdc-drawer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 1cd4d00

Please sign in to comment.