DEV Community

Discussion on: Never make your text container a flexbox container

Collapse
 
andreidascalu profile image
Andrei Dascalu

Well, yes, definitely. It's OK for text, which means that if you can't guarantee it is just that then you need to take measures depending on the end goal. One way could be like you said, to handle it for presentation only.

Although if you don't know what data you will receive I'd argue that you need to sanitize it to match your expectations and practices: eg if I don't expect html tags then I will sanitize the output (or better yet the input so that the dB content matches in the first place). If I do want to support tags then the presentation needs to be aware and be setup accordingly.

Thread Thread
 
afif profile image
Temani Afif

Even if you expect html and you want to have html the issue will still remain. How many developer are aware about how the output will be if the text will contain a link? how many beginners will even think that if I add a link to the above the result will look like I detailed? only few and this is what I am pointing here.

You may be aware about everything and you know perfectly your data but if you don't know flexbox very well you will get that surprise one day. I am trying to avoid you that surprice by explaining some quirks around flexbox that no one will explain to you until you face them ;)

Thread Thread
 
andreidascalu profile image
Andrei Dascalu

That is exactly what I'm saying. If you don't have guarantees it's just text then it's not just text and you don't treat it like just text (eg use a wrapper like you said or whatever fits the use case).
If you do expect just text then you implement the necessary safeguards and treat it like just text (case in which it's OK to just use the box setup).

Some comments have been hidden by the post's author - find out more