Flex positioning: absolute vs vertical (canvas vs vbox)

28 08 2008

Not long ago I was at an Adobe conference and was talking to the speaker about VBox and HBox use. I’d read an article about trying not to nest too many HBox or VBox elements as it could inhibit redraw performance. The speaker couldn’t understand why I’d use vertical and horizontal positioning (VBox & HBox) elements instead of Canvas. I knew there was a reason but I couldn’t remember it.

It just struck me today. I have a global text increaser and decreaser in my application. A Canvas is great for layout, except when it’s children start to outgrow it. When that happens, you’ll get clipping and scrollbars and bang… there goes your accessible web app.

So if your Canvas’s children will remain smaller than the height of your canvas, then use it. Otherwise, start reaching for those Boxes.

Nevertheless, do try to limit your nested vertical/horizontal layout items as much as possible.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: