From 55837db65be7d4628f0970df32ec1acb94e86d9e Mon Sep 17 00:00:00 2001 From: victor-meng <56978073+victor-meng@users.noreply.github.com> Date: Fri, 15 Oct 2021 17:36:48 -0700 Subject: [PATCH] =?UTF-8?q?Revert=20"Fix=20keyboard=20focus=20does=20not?= =?UTF-8?q?=20retain=20on=20'New=20Database'=20button=20a=E2=80=A6=20(#113?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "Fix keyboard focus does not retain on 'New Database' button after closing the 'New Database' blade via ESC key (#1109)" This reverts commit f7e724001047d5dab3405db0b94442c1e41b7af7. * Revert "Fix ally database panel open issue (#1120)" This reverts commit ed1ffb692f270cc4705e7c61c1b4f053de7629c2. --- .../CommandBarComponentButtonFactory.tsx | 9 +-------- .../Panes/AddDatabasePanel/AddDatabasePanel.tsx | 3 --- src/Explorer/SplashScreen/SplashScreen.tsx | 15 ++++----------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx index a1d19e257..e56341d80 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx @@ -307,18 +307,11 @@ function createOpenSynapseLinkDialogButton(container: Explorer): CommandButtonCo function createNewDatabase(container: Explorer): CommandButtonComponentProps { const label = "New " + getDatabaseName(); - const newDatabaseButton = document.activeElement as HTMLElement; - return { iconSrc: AddDatabaseIcon, iconAlt: label, onCommandClick: () => - useSidePanel - .getState() - .openSidePanel( - "New " + getDatabaseName(), - - ), + useSidePanel.getState().openSidePanel("New " + getDatabaseName(), ), commandButtonLabel: label, ariaLabel: label, hasPopup: true, diff --git a/src/Explorer/Panes/AddDatabasePanel/AddDatabasePanel.tsx b/src/Explorer/Panes/AddDatabasePanel/AddDatabasePanel.tsx index 2c5009282..3ee59bd30 100644 --- a/src/Explorer/Panes/AddDatabasePanel/AddDatabasePanel.tsx +++ b/src/Explorer/Panes/AddDatabasePanel/AddDatabasePanel.tsx @@ -23,12 +23,10 @@ import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneFor export interface AddDatabasePaneProps { explorer: Explorer; - buttonElement?: HTMLElement; } export const AddDatabasePanel: FunctionComponent = ({ explorer: container, - buttonElement, }: AddDatabasePaneProps) => { const closeSidePanel = useSidePanel((state) => state.closeSidePanel); let throughput: number; @@ -79,7 +77,6 @@ export const AddDatabasePanel: FunctionComponent = ({ dataExplorerArea: Constants.Areas.ContextualPane, }; TelemetryProcessor.trace(Action.CreateDatabase, ActionModifiers.Open, addDatabasePaneOpenMessage); - buttonElement.focus(); }, []); const onSubmit = () => { diff --git a/src/Explorer/SplashScreen/SplashScreen.tsx b/src/Explorer/SplashScreen/SplashScreen.tsx index d13644bd7..b52593707 100644 --- a/src/Explorer/SplashScreen/SplashScreen.tsx +++ b/src/Explorer/SplashScreen/SplashScreen.tsx @@ -307,23 +307,16 @@ export class SplashScreen extends React.Component { iconSrc: AddDatabaseIcon, title: "New " + getDatabaseName(), description: undefined, - onClick: () => this.openAddDatabasePanel(), + onClick: () => + useSidePanel + .getState() + .openSidePanel("New " + getDatabaseName(), ), }); } return items; } - private openAddDatabasePanel() { - const newDatabaseButton = document.activeElement as HTMLElement; - useSidePanel - .getState() - .openSidePanel( - "New " + getDatabaseName(), - - ); - } - private decorateOpenCollectionActivity({ databaseId, collectionId }: MostRecentActivity.OpenCollectionItem) { return { iconSrc: NotebookIcon,