Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion assets/src/components/repeater/layout/advanced/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,21 @@ $advanced-item-index-height: 40px;
}
}

// Collapse the footprint of a field wrapper whose field rendered nothing (e.g. hidden by a
// visibility condition): the wrapper's only contribution is its padding, so zeroing it makes
// the empty wrapper occupy no space.
//
// Deliberately `padding: 0`, NOT `display: none`. WebKit/Safari evaluates `:has(> :empty)`
// for a freshly inserted subtree BEFORE the subtree's children exist, so on insertion this
// selector matches EVERY field wrapper — and WebKit then fails to re-evaluate it once the
// children are attached (the stale used style persists even though getComputedStyle reports
// the corrected value; any later stylesheet mutation heals it). With `display: none` that
// bug left every field in a newly opened repeater-advanced row invisible — rows expanded to
// an empty 0-height strip for many seconds (until some global style invalidation happened
// to occur). With `padding: 0` the same stale match only costs visible fields their padding
// momentarily, which self-corrects on the next style recalculation.
.tf-repeater-advanced-item-field:has(> div[data-overlay-container="true"]:empty) {
display: none;
padding: 0;
}

.tf-repeater-advanced-item-field:has(input.tf-hidden[type="hidden"]) {
Expand Down
6 changes: 5 additions & 1 deletion assets/src/components/repeater/layout/block/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
padding: 1em;
}

// `padding: 0`, not `display: none`: WebKit evaluates `:has(> :empty)` for a freshly inserted
// subtree before its children exist and never re-evaluates, so `display: none` here left every
// field of a newly mounted repeater item invisible in Safari (see the repeater-advanced layout's
// note for the full story). An empty wrapper with no padding occupies no space anyway.
.tf-repeater-block-item-field:has(> div[data-overlay-container="true"]:empty) {
display: none;
padding: 0;
}
Loading