Webflow sync, pageviews & more.
NEW

Why doesn't the .tab-view element with position: sticky property work correctly on iOS and Safari desktop browsers when it is inside a position: absolute container with overflow: scroll? Can you help me understand this bug and find a solution?

TL;DR
  • Safari doesn't support position: sticky inside absolutely positioned, scrollable containers due to a WebKit bug.
  • To fix, use position: relative on the scrollable parent, move the sticky element outside the scrollable container, or use JavaScript as a fallback.

When using position: sticky inside an absolutely positioned and scrollable container, you might notice the sticky behavior not working in Safari (iOS and desktop). This is due to a known limitation in WebKit, Safari’s rendering engine.

1. Understand the Bug

  • Safari does not properly support position: sticky inside containers that have:
    (a) position: absolute and (b) overflow: scroll or overflow: auto.
    In these conditions, sticky elements either don't stick at all or behave unpredictably.

  • This is caused by how WebKit calculates the sticky offset relative to the wrong scroll container or fails to compute it entirely.

  • Other modern browsers (Chrome, Firefox, Edge) handle this case more gracefully because of better implementation of the CSS sticky positioning spec.

2. Confirm Affected Setup

  • If your structure resembles the following:

  • A parent element with position: absolute and overflow: scroll

  • Inside it, a child element with position: sticky
    Then Safari will ignore the sticky behavior.

  • Even if this works in Chrome or Firefox, it will fail in Safari due to the layout computation issue in its rendering engine.

3. Workaround Options

To fix or bypass the issue, try one of the following solutions:

  • Change the parent to position: relative instead of absolute:

  • This often resolves the bug since Safari handles position: sticky better within relatively positioned containers.

  • Example: Replace position: absolute with position: relative on the scrollable parent if layout permits.

  • Move the sticky element outside of scrolling container:

  • If your layout allows, place the sticky element in a higher-level container that is not affected by overflow.

  • Use JavaScript as a fallback:

  • For critical sticky behavior, use JavaScript to manually update the sticky element’s position on scroll (as a last resort).

  • This increases complexity and is not recommended unless essential.

  • Avoid combining absolute positioning, overflow, and sticky within the same hierarchy if Safari support is important.

4. Test in Webflow

  • In Webflow Designer:
  • Avoid placing sticky elements inside scrollable sections that use absolute positioning.
  • Apply relative positioning to containers with sticky children where possible.

Summary

The position: sticky property doesn't work in Safari when nested inside an absolutely positioned, scrollable element due to a known WebKit bug. The best solution is to use position: relative on the scrollable parent or restructure your layout to move the sticky element outside the scroll context.

Rate this answer

Other Webflow Questions