mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-27 13:44:12 +00:00
Fix typescript strict issues for Upload andnd CommandButtonComponent
This commit is contained in:
@@ -114,8 +114,14 @@ export interface CommandButtonComponentProps {
|
||||
}
|
||||
|
||||
export class CommandButtonComponent extends React.Component<CommandButtonComponentProps> {
|
||||
private dropdownElt: HTMLElement;
|
||||
private expandButtonElt: HTMLElement;
|
||||
private dropdownElt: HTMLDivElement | undefined;
|
||||
private expandButtonElt: HTMLDivElement | undefined;
|
||||
|
||||
constructor(props: CommandButtonComponentProps) {
|
||||
super(props);
|
||||
this.dropdownElt = undefined;
|
||||
this.expandButtonElt = undefined;
|
||||
}
|
||||
|
||||
public componentDidUpdate(): void {
|
||||
if (!this.dropdownElt || !this.expandButtonElt) {
|
||||
@@ -135,15 +141,19 @@ export class CommandButtonComponent extends React.Component<CommandButtonCompone
|
||||
|
||||
private onLauncherKeyDown(event: React.KeyboardEvent<HTMLDivElement>): boolean {
|
||||
if (event.keyCode === KeyCodes.DownArrow) {
|
||||
$(this.dropdownElt).hide();
|
||||
$(this.dropdownElt).show().focus();
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
if (this.dropdownElt) {
|
||||
$(this.dropdownElt).hide();
|
||||
$(this.dropdownElt).show().focus();
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (event.keyCode === KeyCodes.UpArrow) {
|
||||
$(this.dropdownElt).hide();
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
if (this.dropdownElt) {
|
||||
$(this.dropdownElt).hide();
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -185,8 +195,8 @@ export class CommandButtonComponent extends React.Component<CommandButtonCompone
|
||||
<div
|
||||
className="commandExpand"
|
||||
tabIndex={0}
|
||||
ref={(ref: HTMLElement) => {
|
||||
this.expandButtonElt = ref;
|
||||
ref={(instance: HTMLDivElement) => {
|
||||
this.expandButtonElt = instance;
|
||||
}}
|
||||
onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => this.onLauncherKeyDown(e)}
|
||||
>
|
||||
@@ -198,8 +208,8 @@ export class CommandButtonComponent extends React.Component<CommandButtonCompone
|
||||
</div>
|
||||
<div
|
||||
className="commandDropdownContainer"
|
||||
ref={(ref: HTMLElement) => {
|
||||
this.dropdownElt = ref;
|
||||
ref={(instance: HTMLDivElement) => {
|
||||
this.dropdownElt = instance;
|
||||
}}
|
||||
>
|
||||
<div className="commandDropdown">
|
||||
|
||||
Reference in New Issue
Block a user