Skip to content

Instantly share code, notes, and snippets.

@yuschick
Last active November 9, 2017 11:26
Show Gist options
  • Save yuschick/1d947e86077b0b56c5de0e08b6d68605 to your computer and use it in GitHub Desktop.
Save yuschick/1d947e86077b0b56c5de0e08b6d68605 to your computer and use it in GitHub Desktop.
interface Handle {
disengage(): void;
}
class Dialog extends React.Component<Props> {
dialog: HTMLElement | null;
disabledHandle: Handle;
focusHandle: Handle;
componentDidMount() {
this.disabledHandle = Disabled({
filter: this.dialog,
});
this.focusHandle = TabFocus({
context: this.dialog,
});
}
componentWillUnmount() {
this.disabledHandle.disengage();
this.focusHandle.disengage();
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment