pablosichert / react-show-more

Convenience wrapper around react-truncate
https://github.com/One-com/react-truncate
ISC License
37 stars 83 forks source link

Hide on page load #10

Open designbyadrian opened 7 years ago

designbyadrian commented 7 years ago

Currently, the element starts off fully rendered, then reduces its height if there's more content.

A quick solution would be to hide the entire text on first render.

chucksellick commented 7 years ago

This sounds bad for SEO when doing server-side rendering. And of course, you definitely can't measure the text up front on the server.

designbyadrian commented 7 years ago

If it’s done via CSS, there isn’t any impact on SEO or SSR

chucksellick commented 7 years ago

"If it’s done via CSS, there isn’t any impact on SEO or SSR" - that's not true, major search engines can tell if text is hidden via CSS.

designbyadrian commented 7 years ago

You’re right and i was wrong. Regardless, It’s up to me if I want to sacrifice SEO. Now there is no event that tells me when the module is ready, so i can change class of the text blocks.

nupurkapoor commented 6 years ago

@designbyadrian were you able to resolve the issue of element starting off as fully rendered? I too am struggling with this, its not a good user experience if element shrinks abruptly after page load.

UPDATE Realized its an issue with the underlying library react-truncate as well https://github.com/One-com/react-truncate/issues/84