Child with percentage width ignores the actual width of its parent


#1

Child layers seem to ignore the actual width of the parent. Child layers seem to calculate their size based on what was typed in the 'Width' box.

Steps to Reproduce:

  • Create a rectangle that has a width of 100% and a max-width of 500px
  • Create a child inside the rectangle that has a width of 100%

I expected the child to be the width of 100% of the available width in it’s the parent. (500px), but the child was actually 100% of the artboard

Screenshots:


2017.01.17 Status update
#2

Great find and well-written report, thanks @norton!

My first instinct is that this is a bug, since I too would expect the percentages to resolve against the parent's resolved width (max-width, in this case) rather than the set width value.

@Ryan, what do you think?


#3

Agree. The child element should resolve against the driving dimension, whether that is max-width or width.


#4

Sounds good, I'll look into this and get a fix in the next release.


#5

Hi @norton, wanted to follow up with you on this.

I looked into the issue more and was a bit too optimistic about my timeline for a fix.

The layout engine is fairly complicated, and it will be difficult to just fix this behavior.
Since we are planning to rewrite the layout system in the near-term, I'm going to hold off on this issue.
I have, however, implemented a test case in the codebase, which will ensure that we don't have this problem in the next version of the layout system.

Thanks again for the great bug report, and I'll update this topic with an update once the new layout system is finished.