Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure containing block around absolute wrapper. #4278

Merged
merged 3 commits into from
Oct 2, 2023

Conversation

seanparsons
Copy link
Contributor

Problem:
When creating a wrapper element around other elements, if that wrapper includes position: 'absolute', then that could result in some unexpected layouting.

Fix:
When a wrapper element is inserted, if position: 'absolute' is included in the style properties then if any of the following settings aren't in the parent style props a contain: 'layout' is added to the parent props:

  • position: 'absolute'
  • position: 'relative'
  • contain: 'layout'

Commit Details:

  • Implemented fixParentContainingBlockSettings to check a target and see if a containing block needs to be created around that target by assigning contain: 'layout' to the parent.
  • Implemented elementHasPositionOf and elementHasContainLayout utility functions.
  • Hooked fixParentContainingBlockSettings into the WRAP_IN_ELEMENT action.
  • Split apart forElementOptic into a smaller optic which then gets composed onto to get the new forElementChildOptic.
  • Implemented propertyHasSimpleValue utility function.

- Implemented `fixParentContainingBlockSettings` to check
  a target and see if a containing block needs to be created around
  that target by assigning `contain: 'layout'` to the parent.
- Implemented `elementHasPositionOf` and `elementHasContainLayout`
  utility functions.
- Hooked `fixParentContainingBlockSettings` into the `WRAP_IN_ELEMENT`
  action.
- Split apart `forElementOptic` into a smaller optic which then gets
  composed onto to get the new `forElementChildOptic`.
- Implemented `propertyHasSimpleValue` utility function.
@github-actions
Copy link
Contributor

github-actions bot commented Sep 29, 2023

Try me

@relativeci
Copy link

relativeci bot commented Sep 29, 2023

Job #8332: Bundle Size — 62.7MiB (~+0.01%).

d05e458(current) vs 5957b21 master#8329(baseline)

Warning

Bundle contains 64 duplicate packages - View duplicate packages

Bundle metrics (3 changes)
                 Current
Job #8332
     Baseline
Job #8329
Initial JS 34.97MiB(+0.01%) 34.96MiB
Initial CSS 0B 0B
Cache Invalidation 19.36% 18.37%
Chunks 27 27
Assets 31 31
Modules 3971(+0.03%) 3970
Duplicate Modules 422 422
Duplicate Code 30.83% 30.83%
Packages 409 409
Duplicate Packages 64 64
Bundle size by type (1 change)
                 Current
Job #8332
     Baseline
Job #8329
CSS 0B 0B
Fonts 0B 0B
HTML 11.43KiB 11.43KiB
IMG 0B 0B
JS 62.69MiB (~+0.01%) 62.69MiB
Media 0B 0B
Other 0B 0B

View job #8332 reportView fix/containing-block-around-abso... branch activity

@github-actions
Copy link
Contributor

github-actions bot commented Sep 29, 2023

Performance test results:
(Chart1)
(Chart2)

@seanparsons seanparsons merged commit a595f4f into master Oct 2, 2023
11 checks passed
@seanparsons seanparsons deleted the fix/containing-block-around-absolute branch October 2, 2023 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants