WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
REOPENED
321588
visibility: hidden is broken when overflow: hidden is used and parent has relative position
https://bugs.webkit.org/show_bug.cgi?id=321588
Summary
visibility: hidden is broken when overflow: hidden is used and parent has rel...
Alex
Reported
2026-08-12 03:35:15 PDT
The following setup has content hidden in Safari Version 26.5.2 (21624.2.5.11.8): <style> .a { position: relative; visibility: hidden; } .b { overflow: hidden; visibility: visible; } </style> <div class="a"> <div class="b">Lorem ipsum</div> </div> See this Codepen:
https://codepen.io/waterplea/pen/JoEVwgd
Attachments
testcase.html
(4.17 KB, text/html)
2026-08-13 06:32 PDT
,
Karl Dubost
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Karl Dubost
Comment 1
2026-08-13 02:09:33 PDT
FAIL Safari Technology Preview 27.0 (Release 249) 22626.1.1 PASS Firefox Nightly 155.0a1 15526.8.11 PASS Google Chrome Canary 153.0.8004.0 8004.0
Radar WebKit Bug Importer
Comment 2
2026-08-13 02:09:40 PDT
<
rdar://problem/184801325
>
Karl Dubost
Comment 3
2026-08-13 06:32:24 PDT
CSS 2.2, Visibility: the visibility property, on the hidden value: "The generated box is invisible (fully transparent, nothing is drawn), but still affects layout. Furthermore, descendants of the element will be visible if they have visibility: visible."
https://drafts.csswg.org/css2/#valdef-visibility-hidden
No exception for descendants that happen to have non-visible overflow. WebKit is wrong here; Gecko and Blink match the spec. The bug is probably 20 years old. * Antti in d9608747bea5c, 2006-10-11 * Simon only moved it into its own function in 2022 (9094b9af525d3,
bug 235195
) * Alan rewrote the loop shape in 2025 (98aa9fc589265,
bug 290253
) .b is waiting for .a to draw it. .a believes there is nothing to draw. Nobody draws the text. No coverage for this case anywhere. So need a new test. Also web-platform-tests/css/CSS2/visufx/ should be imported. In computeHasVisibleContent() (RenderLayer.cpp:2030), the guard is !renderElement->hasLayer(). What it means to say is "skip children that draw themselves". It says "skip children that have a layer" and uses that as a stand-in. The two are not the same, and that gap is the bug. Change it so a child is only skipped when it has a layer and that layer is self-painting. A child with a non-self-painting layer gets treated like any other child: check its visibility, and look inside it.
Karl Dubost
Comment 4
2026-08-13 06:32:56 PDT
Created
attachment 481046
[details]
testcase.html
Karl Dubost
Comment 5
2026-08-13 06:33:47 PDT
test 1 and 4 are currently failing in WebKit and passing in Firefox/Chrome.
Karl Dubost
Comment 6
2026-08-14 15:24:00 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/71665
EWS
Comment 7
2026-08-16 18:23:09 PDT
Committed
319258@main
(a1d6057613b9): <
https://commits.webkit.org/319258@main
> Reviewed commits have been landed. Closing PR #71665 and removing active labels.
Karl Dubost
Comment 8
2026-08-16 19:27:13 PDT
Submitted web-platform-tests pull request:
https://github.com/web-platform-tests/wpt/pull/61979
Alex
Comment 9
2026-09-29 04:01:02 PDT
This seems to still be broken in Safari 27, or it is something different but which looks exactly the same, could you please have a look at this page in Safari:
https://taiga-ui.dev/components/copy#basic
The first example titled Basic has 3 rows of a component that you hover and see a copy button. The middle one, that spans 2 lines, is broken in Safari the same way as the initial bug, flickering as invisible when you move cursor over it.
Alex
Comment 10
2026-09-30 00:34:19 PDT
This is the most isolated I can get it without rebuilding my code from scratch which I really do not want to do because it's very time consuming:
https://stackblitz.com/edit/angular-hbvp42s8
I'll have to resort to animating opacity from value to value + 0.001 constantly to fix this in Safari, so the previous link will soon stop reproducing, please use the link from this message. It's an Angular playground, but that's irrelevant – you can just explore applied style and DOM structure in devtools to try and figure out what's causing block to disappear.
Alex
Comment 11
2026-10-08 07:20:32 PDT
Oh, I didn't see that I can reopen the bug myself. Please see the StackBlitz link above.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug