Skip to content

no strokeDasharray on markers#2381

Merged
Fil merged 5 commits intomainfrom
fil/fix-2131
Apr 3, 2026
Merged

no strokeDasharray on markers#2381
Fil merged 5 commits intomainfrom
fil/fix-2131

Conversation

@Fil
Copy link
Copy Markdown
Contributor

@Fil Fil commented Mar 13, 2026

closes #2131

@Fil Fil requested a review from mbostock March 13, 2026 07:56
@Fil Fil enabled auto-merge (squash) March 13, 2026 07:56
Copy link
Copy Markdown
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

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

What about the alternative fix of putting the marker into a defs element (or simply outside the g element, somewheres) so that it doesn’t inherit attributes? Would that be a more general fix? For example, is there a similar issue with the fill and stroke-opacity being inherited (or is that inheritance desirable)?

(Was wondering if there would be an issue here if strokeDasharray were specified as a channel, but that’s not supported, so it’s nice that we can simplify. Was also wondering if we should always set stroke-dasharray="none" but I guess it’s nice to avoid if necessary.)

@Fil Fil disabled auto-merge April 1, 2026 15:17
@Fil
Copy link
Copy Markdown
Contributor Author

Fil commented Apr 1, 2026

a) I believe stroke-opacity is useful to inherit. fill doesn't really make sense in any of the supported marks.

b) I researched the idea of using an external <defs> group, but I wouldn't want to add that group to the top-level svg (it makes it harder to control multiple renderings with, say, a pointer transform: the number of defs might grow unbounded). We could nest the current <g> under a wrapper <g> that also includes <defs> as a sibling of the styled <g>, but it feels "too much" given point a) above.

@Fil
Copy link
Copy Markdown
Contributor Author

Fil commented Apr 1, 2026

Side note: in the arrow mark, which has potentially a fill and a marker, the marker has the same fill color … and that looks ok.

Capture d’écran 2026-04-01 à 17 44 26

Copy link
Copy Markdown
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

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

I simplified this to just always set stroke-dasharray=none, which I feel is more consistent with how we handle the other attributes. That causes some redundant effort (especially since stroke-dasharray is rare), but it seems fine.

@Fil Fil merged commit 569e0f1 into main Apr 3, 2026
1 check passed
@Fil Fil deleted the fil/fix-2131 branch April 3, 2026 04:25
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.

strokeDashArray affects markers

2 participants