Collapse: measure a flow-root content wrapper - #9
Merged
Conversation
The measured inner div wasn't a block formatting context, so children's margins collapsed through it and scrollHeight under-measured; the outer overflow:hidden wrapper IS a BFC and lays the margins out inside itself, so the resting fixed height clipped the last line of margined content (python-editor's API docs: 63px measured vs 74px real - the content's first paragraph carries a 10.56px top margin). display: flow-root makes the measurement truthful; rendering is unchanged since the margins were always painted inside the outer BFC.
microbit-matt-hillsdon
added a commit
that referenced
this pull request
Aug 3, 2026
Two findings from classroom's leaf-primitive port. #30: Chakra's reset carries normalize's `hr { box-sizing: content-box }` and Panda's preflight sets border-box on everything with no `hr` exception, so an `<hr>` with an explicit height plus top/bottom borders silently changes height at the flip. The zero-size-hr double-edge trick (1px on all four sides of a 0-width hr, the side borders reading as one 2px rule) is exactly that shape and was in three apps; Divider's `thickness` variant is height-stable instead. classroom's logo divider was 35px rather than the 33px its code asked for, and was the only pixel difference across five screens. #9/#17: confirmed from the other direction that a literal utility-named prop does survive a plain wrapper — `h={23}` extracted and emitted `height: 23px`, matching Chakra's unitless-number handling exactly. So #9's real scope is non-literal values and non-utility prop names, which is worth saying plainly next to the wrapper advice it seemed to contradict.
microbit-matt-hillsdon
added a commit
that referenced
this pull request
Aug 3, 2026
Two findings from classroom's leaf-primitive port. #30: Chakra's reset carries normalize's `hr { box-sizing: content-box }` and Panda's preflight sets border-box on everything with no `hr` exception, so an `<hr>` with an explicit height plus top/bottom borders silently changes height at the flip. The zero-size-hr double-edge trick (1px on all four sides of a 0-width hr, the side borders reading as one 2px rule) is exactly that shape and was in three apps; Divider's `thickness` variant is height-stable instead. classroom's logo divider was 35px rather than the 33px its code asked for, and was the only pixel difference across five screens. #9/#17: confirmed from the other direction that a literal utility-named prop does survive a plain wrapper — `h={23}` extracted and emitted `height: 23px`, matching Chakra's unitless-number handling exactly. So #9's real scope is non-literal values and non-utility prop names, which is worth saying plainly next to the wrapper advice it seemed to contradict.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spotted reviewing Python Editor.
The measured inner div wasn't a block formatting context, so children's margins collapsed through it and scrollHeight under-measured; the outer overflow:hidden wrapper IS a BFC and lays the margins out inside itself, so the resting fixed height clipped the last line of margined content (python-editor's API docs: 63px measured vs 74px real - the content's first paragraph carries a 10.56px top margin). display: flow-root makes the measurement truthful; rendering is unchanged since the margins were always painted inside the outer BFC.