Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Auto-focus on entity profile action modals #9264

Closed

Conversation

Salman-Apptware
Copy link
Contributor

Checklist

@github-actions github-actions bot added the product PR or Issue related to the DataHub UI/UX label Nov 17, 2023

// If the modal content is dynamic or the modal is not rendered immediately.
// we ned need to use the useEffect hook to ensure that the Select component gets the default value after the modal is mounted.
useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! do we need to do this anywhere else? tags, glossary terms?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes where we want default value we have to do this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in previous code we are using default value that's the reason I have added this code but in other place we are not using default value so not added this code there. In other places like glossary, term it is working expected without writing this code. If you want we can remove this code from EditWonerModal as well but in future we may required to add default value that's the reason I have kept this code here

@@ -221,3 +221,6 @@ export function sortEntityProfileTabs(appConfig: AppConfig, entityType: EntityTy

return sortedTabs;
}

// To focus out from modal popup so autofocus works
export const getContainer = () => document.getElementById('root') as HTMLElement;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, did we try to add the id to the app.tsx?

let's move this into a different place. let's put it in a root folder: src/app/utils/focus

Copy link
Collaborator

@jjoyce0510 jjoyce0510 Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's say getModalDomContainer.

Also please write a bit of a more detailed comment here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we be 100% positive that the "root" id will never change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById('root'), );
here also we are using root as id if this cannot be change we are 100% sure id will not be change

Copy link
Contributor Author

@Salman-Apptware Salman-Apptware Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's move this into a different place. let's put it in a root folder: src/app/utils/focus.

sure will add this to app/utils/focus and change name to getModalDomContainer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, did we try to add the id to the app.tsx?

In App.tsx we have written all context and routing related code, for adding Id we have to add extra node of div and other person will be confused why we have given id there instead we can use root as id that will not change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the MR please review and let me know

@@ -92,6 +93,7 @@ export default function EditTagTermsModal({
defaultValues = [],
onOkOverride,
}: EditTagsModalProps) {
console.log(visible,"visible=====")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to get rid

@@ -30,6 +30,15 @@ describe("glossary sidebar navigation test", () => {
cy.get('[data-testid="glossary-browser-sidebar"]').contains(glossaryTermGroup).click().wait(3000);
cy.get('*[class^="GlossaryEntitiesList"]').contains(glossaryTerm).should("be.visible");

// create glossaryParentGroup
cy.goToGlossaryList();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why this is necessary? Seems that glossary_navigation is still not passing : /

@Salman-Apptware
Copy link
Contributor Author

test failing so creating new branch

@Salman-Apptware Salman-Apptware deleted the feat/PRD-789 branch December 12, 2023 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR or Issue related to the DataHub UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants