Skip to content

the title channel is not filtering the mark, unless it's a tip mark #1704

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

Merged
merged 2 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/marks/tip.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class Tip extends Mark {
textAnchor = "start",
textOverflow,
textPadding = 8,
title,
pointerSize = 12,
pathFilter = "drop-shadow(0 3px 4px rgba(0,0,0,0.2))"
} = options;
Expand All @@ -56,7 +57,8 @@ export class Tip extends Mark {
x1: {value: x1, scale: "x", optional: x2 == null},
y1: {value: y1, scale: "y", optional: y2 == null},
x2: {value: x2, scale: "x", optional: x1 == null},
y2: {value: y2, scale: "y", optional: y1 == null}
y2: {value: y2, scale: "y", optional: y1 == null},
title: {value: title, optional: true} // filter: defined
Copy link
Member

Choose a reason for hiding this comment

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

So, just for posterity: this works because the channels that are defined here override the default channels that are declared by styles. And that’s specifically because styles is listed first in the spread here:

if (defaults !== undefined) channels = {...styles(this, options, defaults), ...channels};

That’s fine. It’s a little subtle, but it makes sense that the mark-specific channel definitions would override the defaults.

},
options,
defaults
Expand Down
4 changes: 2 additions & 2 deletions src/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ export function styles(
mark.shapeRendering = impliedString(shapeRendering, "auto");

return {
title: {value: title, optional: true},
title: {value: title, optional: true, filter: null},
href: {value: href, optional: true, filter: null},
ariaLabel: {value: variaLabel, optional: true},
ariaLabel: {value: variaLabel, optional: true, filter: null},
fill: {value: vfill, scale: "auto", optional: true},
fillOpacity: {value: vfillOpacity, scale: "auto", optional: true},
stroke: {value: vstroke, scale: "auto", optional: true},
Expand Down
Loading