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

Axis label SVG <title/> element text is repeated when label includes a <br /> tag and is truncated. #5211

Closed
jbgarr opened this Issue Apr 13, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@jbgarr

jbgarr commented Apr 13, 2016

If an axis label includes a <br /> tag in it and the text is long enough to get truncated, then the SVG <title/> tag that is created includes repeated text. I have included a jsFiddle of an example here: http://jsfiddle.net/jbgarr/u4oc0x54/

In order to reproduce the issue make sure the browser window is skinny enough so that both lines of the Friday... label are truncated. In Chrome V49.0.2623.110 the title is then rendered as a tooltip that includes the repeated text. It can also be seen by inspecting the element in the dev tools.

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Apr 14, 2016

Collaborator

Normalized demo
If we set the chart width to 350px it reproduces: http://jsfiddle.net/highcharts/u4oc0x54/5/

Collaborator

TorsteinHonsi commented Apr 14, 2016

Normalized demo
If we set the chart width to 350px it reproduces: http://jsfiddle.net/highcharts/u4oc0x54/5/

@jon-a-nygaard

This comment has been minimized.

Show comment
Hide comment
@jon-a-nygaard

jon-a-nygaard Apr 18, 2016

Collaborator

This issue will be fixed in the next maintenance release. For those in need of an immediate fix, have a look at the workaround below.

Workaround
Open the source file e.g highcharts.src.js in a text editor. Search and locate the function buildText Look for the following part around line 1600

if (wasTooLong) {
    wrapper.attr('title', wrapper.textStr);
}

and replace it with the following part

if (wasTooLong && lineNo === 0) {
    wrapper.attr('title', wrapper.textStr);
}
Collaborator

jon-a-nygaard commented Apr 18, 2016

This issue will be fixed in the next maintenance release. For those in need of an immediate fix, have a look at the workaround below.

Workaround
Open the source file e.g highcharts.src.js in a text editor. Search and locate the function buildText Look for the following part around line 1600

if (wasTooLong) {
    wrapper.attr('title', wrapper.textStr);
}

and replace it with the following part

if (wasTooLong && lineNo === 0) {
    wrapper.attr('title', wrapper.textStr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment