nextcloud-vue icon indicating copy to clipboard operation
nextcloud-vue copied to clipboard

[NcFormBox] Use `text-wrap: pretty` for FormBox* components where supported

Open kra-mo opened this issue 1 month ago • 7 comments

This is what it looks like with default wrapping:

Image

And pretty:

Image

Support is low-ish right now, but it's literally just to make something more pretty so probably not an issue :)

kra-mo avatar Nov 11 '25 15:11 kra-mo

Even if not well supported at least the browsers with support get better ui :) So really nice idea!

susnux avatar Nov 12 '25 17:11 susnux

For longer sections of text, text-wrap: pretty can be used. Note that pretty has a negative effect on performance, so it should be only used for longer blocks of text when the layout is more important than speed.

ShGKme avatar Nov 12 '25 17:11 ShGKme

I did not make any research about the performance impact. But having performance issues we have already, I'd make sure that the performance impact of this option is not noticeable anymore and worth it.

ShGKme avatar Nov 12 '25 19:11 ShGKme

I'd make sure that the performance impact of this option is not noticeable anymore and worth it.

As this components are only shown in the app settings dialog I think that's not really a problem - also the amount of components with text wrapping should normally not be that much.

susnux avatar Nov 12 '25 19:11 susnux

WebKit:

We are thrilled with the work we’ve done to ensure Safari users don’t experience a negative performance impact, even when web developers apply text-wrap: pretty to a lot of content on the web page.

One thing to know as a developer, the performance of text-wrap is not affected by how many elements on the page it’s applied to. Perf concerns emerge as the pretty algorithm takes more and more lines into consideration as it calculates what to do. In WebKit-based browsers or apps, your text element would need to be many hundreds or thousands of lines long to see a performance hit — and that kind of content is unusual on the web. If your content is broken up into typical-length paragraphs, then you have no reason to worry. Use text-wrap: pretty as much as you want, and rely on our browser engineers to ensure your users will not experience any downsides.

A Blink developer:

Blink's implementation of pretty has explicitly added guardrails such that the overhead is minimal if a site added it to every paragraph, and during development we measured performance of page load times in this scenario and found it acceptable.

kra-mo avatar Nov 13 '25 08:11 kra-mo

@kra-mo Only the interactive items, or anything else as well?

Such us the groups headings/description, shortcuts labels etc.

ShGKme avatar Nov 13 '25 10:11 ShGKme

@kra-mo Only the interactive items, or anything else as well?

Such us the groups headings/description, shortcuts labels etc.

No strong opinions. I found the wrapping odd for interactive elements only because of the trailing icon/switch.

At least for shortcuts labels, that would also apply because of the keys on the right side. For other things, it's your call.

kra-mo avatar Nov 13 '25 10:11 kra-mo