Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Add maxRows to Text #467

Open
chrismohr opened this issue Jul 19, 2018 · 4 comments
Open

Add maxRows to Text #467

chrismohr opened this issue Jul 19, 2018 · 4 comments

Comments

@chrismohr
Copy link
Contributor

This would be used to truncate multiline text for components like the weblink preview.

weblink preview

To do this would likely involve parsing the numeric portion of the lineHeight, and multiplying by the supplied value.

@unindented
Copy link
Contributor

unindented commented Jul 19, 2018

Even if you were to correctly calculate the height, how would you introduce the ellipsis?

@chrismohr
Copy link
Contributor Author

I'm open to suggestions... I imagine we'd want to consult a designer.

Some options:

Maybe an offset one with a pseudo element?

Or maybe we could progressively enhance and use --webkit-line-clamp for browsers that support it.

Or maybe better would be a fade?

Like this:
https://medium.com/@hey.aaron/truncating-multi-line-content-in-fixed-height-containers-by-fading-7f8ab4635648

Or this:
https://css-tricks.com/text-fade-read-more/

@unindented
Copy link
Contributor

We'll have to consult with @BrendanMcK and our designers, see which option is preferable.

@BrendanMcK
Copy link
Contributor

My understanding is that since the clipping is purely visual, and the DOM still contains all the original text, a screenreader will still read out the full content. That's acceptable in most cases.

OTOH, if the content was significantly larger than the visible portion, we might want to ensure that the screenreader also only reads out text cropped to the same ballpark (ie doesn't need to crop at exact same character, just reads out roughly the same amount).

But if we're confident there won't be more than a few lines here anyhow, that's likely not an issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants