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

🐛 [BUG]: Cannot add data-* attributes to BaseEdge #1741

Closed
1 task done
Tracked by #1742
alexgrozav opened this issue Jan 9, 2025 · 6 comments
Closed
1 task done
Tracked by #1742

🐛 [BUG]: Cannot add data-* attributes to BaseEdge #1741

alexgrozav opened this issue Jan 9, 2025 · 6 comments
Assignees
Labels
refactor Refactor existing features

Comments

@alexgrozav
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and this is a new bug.

Current Behavior

BaseEdge does not render data-* attributes such as data-test-id.

Expected Behavior

BaseEdge should render any data-* attribute you pass to it.

Steps To Reproduce

  1. Create custom edge
  2. Add data-* attributes such as data-test-id to it.

Minimal reproduction of the issue with CodeSandbox

No response

Relevant log output

No response

Anything else?

Screenshot 2025-01-09 at 12 27 36
@alexgrozav alexgrozav added bug Something isn't working triage Awaiting triage labels Jan 9, 2025
@bcakmakoglu
Copy link
Owner

I don't see why this is a "bug".
The BaseEdge doesn't inherit attributes since it renders a fragment with two paths (one for the visible path and one for an invisible overlay for better interaction purposes).
If you need to add some test id why not just wrap it and add the id to the wrapper?

<g data-test-id="my-test-id">
	<BaseEdge .../>
</g>

@bcakmakoglu
Copy link
Owner

I can offer to refactor the BaseEdge to inherit attributes on it's main path element.
You won't be able to add these attributes to the secondary interaction path element though (which I don't think you'll need anyway and if you do you can select it with a querySelector instead).

@alexgrozav
Copy link
Author

I'll see if I can get around it with wrapping. Thank you for the suggestion!

@bcakmakoglu bcakmakoglu added refactor Refactor existing features and removed bug Something isn't working triage Awaiting triage labels Jan 9, 2025
@alexgrozav
Copy link
Author

Thank you! That worked perfectly. Somehow, I didn't realize I can use an svg group for that, learned something new today.

Feel free to close this since it has a simple workaround.

@bcakmakoglu
Copy link
Owner

I'll still allow binding attrs to the base edge main element since that makes sense.
This change will be released in the next minor :)

@bcakmakoglu
Copy link
Owner

Fix released with 1.42.0

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

No branches or pull requests

2 participants