Lint: no-unused-expressions (error) (#4197)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-11-01 08:37:37 -04:00
1 parent c6dab62e99
commit e74f17e8ce
9 files changed
+79 -50

No files matched your search

+21 -4
View File
@@ -90,6 +90,10 @@ export class Menu extends React.Component<MenuProps, State> {
return !!this.props.isOpen;
}
get isClosed() {
return !this.isOpen;
}
componentDidMount() {
if (!this.props.usePortal) {
const parent = this.elem.parentElement;
@@ -202,19 +206,32 @@ export class Menu extends React.Component<MenuProps, State> {
};
open() {
if (this.isOpen) return;
if (this.isOpen) {
return;
}
this.props.open();
this.refreshPosition();
if (this.props.autoFocus) this.focusNextItem();
if (this.props.autoFocus) {
this.focusNextItem();
}
}
close() {
if (!this.isOpen) return;
if (this.isClosed) {
return;
}
this.props.close();
}
toggle() {
this.isOpen ? this.close() : this.open();
if (this.isOpen) {
this.close();
} else {
this.open();
}
}
onKeyDown(evt: KeyboardEvent) {