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

Replace react-router-dom Link with div for inner clickables #8323

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

khuddite
Copy link

@khuddite khuddite commented Nov 4, 2024

Fixes #8298

  1. Origin of the issue
    When there is a clickable inside the table row, it uses the Link component from react-router-dom. But at the same time, table row is also using Link component for navigation when it's clickable. Since Link component uses a tag under the hood, it results in a nested a tag warning in the dev console. People row is an example that causes the issues under Companies data model.

  2. Changes made
    Replaced the inner Link component with div tag that triggers navigation on onClick event. Stopped the event from bubbling up to the table row and prevented the default navigation behavior of the table row as well.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR fixes nested <a> tag warnings in the dev console by replacing the React Router Link component with a div in clickable table elements.

  • Modified packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldDataType.tsx to use useNavigate hook instead of Link
  • Added click event handling with event bubbling prevention in SettingsObjectFieldDataType
  • Maintains existing navigation functionality while resolving HTML validation issues
  • Addresses issue Error in devtools while checking fields of object #8298 where nested anchor tags were causing dev console warnings

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error in devtools while checking fields of object
1 participant