Safari abosulte position element rending issue on iOS 17 & macOS Sonoma

On Safari of iOS 17 and macOS Sonoma, I am encountering a layout problem where the .content element seems to be covering the .header element, resulting in unexpected rendering. This issue is not consistently reproducible across different devices or browsers.

Here's the HTML and CSS structure:

https://xs9627.github.io/iOS17-position-bug/

<html>
    <head>
        <meta name="viewport" content="initial-scale=1.0">
        <style>
            .page {
                position: absolute;
                height: 100%;
                width: 100%;
                overflow: auto;
            }

            .container {
                height: 100%;
                width: 100%;
                overflow: auto;
            }

            .header {
                position: absolute;
                top: 0;
                background: lightblue;
                height: 50px;
                width: 100%;
            }

            .content {
                height: 2000px;
                background: lightcoral;
                box-sizing: border-box;
            }

        </style>
    </head>
    <body>
        <div class="page">
            <div class="container">
                <div class="header">header</div>
                <div class="content">content</div>
            </div>
        </div>
    </body>

</html>

If remove overflow in .page, or make .content not scrollable, .header shows correct that overlap .content

Replies

Thank you for reporting this issue. I can reproduce, and have filed it in our bug tracker as https://bugs.webkit.org/show_bug.cgi?id=261302.