From 8cfe4abfad282d55be3dbdc868ab7af243463aee Mon Sep 17 00:00:00 2001 From: salman Date: Tue, 12 Dec 2023 14:52:18 +0530 Subject: [PATCH] feat: Auto-focus on entity profile action modals --- .../shared/EntityDropdown/MoveGlossaryEntityModal.tsx | 3 +++ .../app/entity/shared/EntityDropdown/NodeParentSelect.tsx | 2 ++ .../app/entity/shared/components/styled/AddLinkModal.tsx | 2 ++ .../profile/sidebar/DataProduct/SetDataProductModal.tsx | 2 ++ .../containers/profile/sidebar/Domain/SetDomainModal.tsx | 2 ++ .../profile/sidebar/Ownership/EditOwnersModal.tsx | 2 ++ .../src/app/entity/view/builder/ViewBuilderModal.tsx | 2 ++ datahub-web-react/src/app/shared/tags/AddTagsTermsModal.tsx | 2 ++ datahub-web-react/src/utils/focus/index.ts | 6 ++++++ 9 files changed, 23 insertions(+) create mode 100644 datahub-web-react/src/utils/focus/index.ts diff --git a/datahub-web-react/src/app/entity/shared/EntityDropdown/MoveGlossaryEntityModal.tsx b/datahub-web-react/src/app/entity/shared/EntityDropdown/MoveGlossaryEntityModal.tsx index 37a625f58100b..51b39be4e20ea 100644 --- a/datahub-web-react/src/app/entity/shared/EntityDropdown/MoveGlossaryEntityModal.tsx +++ b/datahub-web-react/src/app/entity/shared/EntityDropdown/MoveGlossaryEntityModal.tsx @@ -7,6 +7,7 @@ import { useUpdateParentNodeMutation } from '../../../../graphql/glossary.genera import NodeParentSelect from './NodeParentSelect'; import { useGlossaryEntityData } from '../GlossaryEntityContext'; import { getGlossaryRootToUpdate, getParentNodeToUpdate, updateGlossarySidebar } from '../../../glossary/utils'; +import { getModalDomContainer } from '../../../../utils/focus'; const StyledItem = styled(Form.Item)` margin-bottom: 0; @@ -78,6 +79,7 @@ function MoveGlossaryEntityModal(props: Props) { } + getContainer={getModalDomContainer} >
diff --git a/datahub-web-react/src/app/entity/shared/EntityDropdown/NodeParentSelect.tsx b/datahub-web-react/src/app/entity/shared/EntityDropdown/NodeParentSelect.tsx index c3bfac35c2ca6..e7f5827e33dcc 100644 --- a/datahub-web-react/src/app/entity/shared/EntityDropdown/NodeParentSelect.tsx +++ b/datahub-web-react/src/app/entity/shared/EntityDropdown/NodeParentSelect.tsx @@ -21,6 +21,7 @@ interface Props { selectedParentUrn: string; setSelectedParentUrn: (parent: string) => void; isMoving?: boolean; + autofocus?: boolean; } function NodeParentSelect(props: Props) { @@ -65,6 +66,7 @@ function NodeParentSelect(props: Props) { onClear={clearSelectedParent} onFocus={() => setIsFocusedOnInput(true)} dropdownStyle={isShowingGlossaryBrowser || !searchQuery ? { display: 'none' } : {}} + autoFocus={props.autofocus} > {nodeSearchResults?.map((result) => ( diff --git a/datahub-web-react/src/app/entity/shared/components/styled/AddLinkModal.tsx b/datahub-web-react/src/app/entity/shared/components/styled/AddLinkModal.tsx index 68a8cf4094362..9e18de3b294bf 100644 --- a/datahub-web-react/src/app/entity/shared/components/styled/AddLinkModal.tsx +++ b/datahub-web-react/src/app/entity/shared/components/styled/AddLinkModal.tsx @@ -5,6 +5,7 @@ import { useEntityData, useMutationUrn } from '../../EntityContext'; import { useAddLinkMutation } from '../../../../../graphql/mutations.generated'; import analytics, { EventType, EntityActionType } from '../../../../analytics'; import { useUserContext } from '../../../../context/useUserContext'; +import { getModalDomContainer } from '../../../../../utils/focus'; type AddLinkProps = { buttonProps?: Record; @@ -73,6 +74,7 @@ export const AddLinkModal = ({ buttonProps, refetch }: AddLinkProps) => { Add , ]} + getContainer={getModalDomContainer} > } + getContainer={getModalDomContainer} >