Open Bug 890692 Opened 12 years ago Updated 2 months ago

maybe support textLength="" and lengthAdjust="" on tspan and textPath

Categories

(Core :: SVG, defect)

defect

Tracking

()

Webcompat Priority P3

People

(Reporter: heycam, Unassigned)

References

Details

(Keywords: access, parity-chrome, parity-safari)

Attachments

(3 files)

Bug 569722 added support for textLength="" and lengthAdjust="" on <text> but not <tspan> and <textPath>. We should think about whether it makes sense to support them on these child elements as the spec currently says, and bring it up in the WG if not. If we do support this, we'll need to change SVGTextPathElement::Get{Enum,Length}Info to also include these attributes, since they currently override the ones on SVGTextContentElement.
Summary: maybe support textLength="" and lengthAdjust="" on tspan and textPath → maybe support textLength="" and lengthAdjust="" on altGlyph, tspan and textPath
Here's a test case showing how textLength on SVG can be used. It's a single <text> element containing a separate <tspan> for each line. These lines wrap around a rectangle, e.g. an image in a newspaper style layout.
Implementing this for <tspan> would work wonders for multiline text. Right now I have to use <text> for everything to get the proper fallback behavior, which has two problems: * Text selection gets weird (Firefox interprets <tspan> boundaries like inline elements, <text> boundaries like line breaks) * Assistive technology thinks each <text> should be treated like a paragraph
Yes. Since it is in the spec it seems good to implement it (this bug seems to have been around a long time). My webapp looks fine in IE and webkit, but was unreadable in firefox. My workaround is to not use tspan on firefox but that breaks screen readers for the blind.
<svg width="350" height="200" viewBox="0 0 350 200"> <text textLength="350"> <tspan x="1" y="80">I am a single line of text inside an SVG</tspan> <tspan x="1" y="100">and this is basically one sentence.</tspan> </text> <rect x="0" y="0" width="350" height="200" fill="none" stroke="blue" stroke-width="2"></rect> </svg>
<svg width="350" height="200" viewBox="0 0 350 200"> <text> <tspan x="1" y="80" textLength="350">I am a single line of text inside an SVG</tspan> <tspan x="1" y="100" textLength="350">and this is basically one sentence.</tspan> </text> <rect x="0" y="0" width="350" height="200" fill="none" stroke="blue" stroke-width="2"></rect> </svg>
Summary: maybe support textLength="" and lengthAdjust="" on altGlyph, tspan and textPath → maybe support textLength="" and lengthAdjust="" on tspan and textPath

The SVG 2 CR does mention both attributes as valid for <textPath>, and Chrome supports this as well, even though they do not support textLength on the <text>. Because we have received a webcompat report about this, this may be breaking some things.

Webcompat Priority: --- → ?
Webcompat Priority: ? → P3
Severity: normal → S3

Note that MDN claims support since FF 1.5 for these attributes https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/tspan#browser_compatibility , which I filed as defect of documentation in https://github.com/mdn/browser-compat-data/issues/26945.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: