Skip to content

[Bug] <sup> for trace.name is not respected in hoverlabel #3357

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

Closed
Braintelligence opened this issue Dec 20, 2018 · 6 comments · Fixed by #3443
Closed

[Bug] <sup> for trace.name is not respected in hoverlabel #3357

Braintelligence opened this issue Dec 20, 2018 · 6 comments · Fixed by #3443
Assignees
Labels
bug something broken

Comments

@Braintelligence
Copy link

Braintelligence commented Dec 20, 2018

Hello everyone.
If you provide a name for your trace containing <sup> it doesn't work for hoverlabels with hoverinfo containing name.

https://codepen.io/anon/pen/aPpmzw

As you can see, the legend is correct but the hoverlabel shows the number as if <sup> was never provided.

@Braintelligence Braintelligence changed the title [Bug] <sup> is not respected in hoverlabel [Bug] <sup> for trace.name is not respected in hoverlabel Dec 20, 2018
@Braintelligence
Copy link
Author

Just to make sure: This bug is still true for 1.43.0.

@etpinard etpinard added the bug something broken label Dec 20, 2018
@etpinard
Copy link
Contributor

Thanks for the report

@Braintelligence
Copy link
Author

@etpinard Did someone look at this bug yet? 😸 Need to know if this will be fixed within this quarter, so I can refactor some of the plots before we publish them with this bug.

@etpinard
Copy link
Contributor

We currently strip out all pseudo-html tags for trace.name here:

if(d.name) {
// strip out our pseudo-html elements from d.name (if it exists at all)
name = svgTextUtils.plainText(d.name || '');
var nameLength = Math.round(d.nameLength);
if(nameLength > -1 && name.length > nameLength) {
if(nameLength > 3) name = name.substr(0, nameLength - 3) + '...';
else name = name.substr(0, nameLength);
}
}

I don't remember why we do this. Maybe @alexcjohnson remembers?

@alexcjohnson
Copy link
Collaborator

I suspect we hadn't bothered figuring out vertical sizing of the name field, also we're often truncating the name and it could be weird to truncate in the middle of some pseudo-html. Probably wouldn't be too hard to resolve these issues and allow pseudo-html there though. I'm a bit concerned about color there though: it would be pretty easy to have colored text in the legend - either part or all of name - that would be ugly or even invisible in the hover label.

@Braintelligence
Copy link
Author

Braintelligence commented Jan 17, 2019

Would it be viable to just allow <sup> for now?

EDIT: Truncating in the middle of the pseudo HTML would be really awful, though... This should be fixable by applying agnostic HTML tag regex I guess.

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

Successfully merging a pull request may close this issue.

3 participants