diff --git a/src/Explorer/Panes/PanelContainerComponent.tsx b/src/Explorer/Panes/PanelContainerComponent.tsx index 4ddc59033..fba9ffcb2 100644 --- a/src/Explorer/Panes/PanelContainerComponent.tsx +++ b/src/Explorer/Panes/PanelContainerComponent.tsx @@ -76,7 +76,42 @@ export class PanelContainerComponent extends React.Component= 0 || + (element instanceof HTMLAnchorElement && element.href) || + (element instanceof HTMLAreaElement && element.href) || + (element instanceof HTMLInputElement && !element.disabled) || + (element instanceof HTMLSelectElement && !element.disabled) || + (element instanceof HTMLTextAreaElement && !element.disabled) || + (element instanceof HTMLButtonElement && !element.disabled) + ); + } + private findFocusableParent = (element: HTMLElement) => { + while (element) { + if (this.isFocusable(element)) { + return element; + } + element = element.parentNode as HTMLElement; + } + return null; + }; + private onDissmiss = (ev?: KeyboardEvent | React.SyntheticEvent): void => { + let elementIdToFocus = sessionStorage.getItem("focusedElementId") || null; + if (elementIdToFocus) { + let targetElement = document.getElementById(elementIdToFocus); + + if (targetElement) { + let focusableParent = this.findFocusableParent(targetElement); + if (focusableParent) { + setTimeout(() => { + focusableParent.focus(); + }, 100); + sessionStorage.removeItem("focusedElementId"); + } + } + } if (ev && (ev.target as HTMLElement).id === "notificationConsoleHeader") { ev.preventDefault(); } else { diff --git a/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx b/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx index f78ada849..f2533877d 100644 --- a/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx +++ b/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx @@ -224,6 +224,7 @@ export default class QueryTabComponent extends React.Component { + sessionStorage.setItem("focusedElementId", "savequery"); useSidePanel.getState().openSidePanel("Save Query", ); }; @@ -394,6 +395,7 @@ export default class QueryTabComponent extends React.Component