mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix crash when opening pod details (#6376)
Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
a7ea891458
commit
fced6e6554
@ -79,10 +79,10 @@ class NonInjectedMenu extends React.Component<MenuProps & Dependencies, State> {
|
||||
super(props);
|
||||
autoBind(this);
|
||||
}
|
||||
public opener: HTMLElement | null = null;
|
||||
public elem: HTMLUListElement | null = null;
|
||||
private opener: HTMLElement | null = null;
|
||||
private elem: HTMLUListElement | null = null;
|
||||
protected items: { [index: number]: MenuItem } = {};
|
||||
public state: State = {};
|
||||
state: State = {};
|
||||
|
||||
get isOpen() {
|
||||
return !!this.props.isOpen;
|
||||
@ -98,15 +98,15 @@ class NonInjectedMenu extends React.Component<MenuProps & Dependencies, State> {
|
||||
htmlFor,
|
||||
toggleEvent,
|
||||
} = this.props;
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const elem = this.elem!;
|
||||
|
||||
if (!usePortal) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const parent = elem.parentElement!;
|
||||
const position = window.getComputedStyle(parent).position;
|
||||
if (this.elem?.parentElement) {
|
||||
const { position } = window.getComputedStyle(this.elem.parentElement);
|
||||
|
||||
if (position === "static") parent.style.position = "relative";
|
||||
if (position === "static") {
|
||||
this.elem.parentElement.style.position = "relative";
|
||||
}
|
||||
}
|
||||
} else if (this.isOpen) {
|
||||
this.refreshPosition();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user