question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v4-beta3 sticky-top not working on safari

See original GitHub issue

Hello,

I am just developing website with v4-beta3 and sticky-top is not working. The @supports rule doesnt get applied. I found older post with this code:

@supports ((position: -webkit-sticky) or (position: sticky)) {
  .sticky-top {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1020;
  }
}

When I replace the new code with the old it is working.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
brazenest-zzcommented, Mar 29, 2018

I’ve encountered this problem occurs on:

  • Safari 11.0.3 on macOS
  • Safari on iOS 11.2.6
  • Chrome 65 on iOS
  • Firefox 10.6 on iOS
  • Edge 41.13 on iOS

… that isn’t an exhaustive list, but it covers the lion’s share of mobile browsing.

For the fix, @Webotvorba has the right idea: we need to add a position: -webkit-sticky rule above the non-prefixed position: sticky one. I’m a fan of wrapping the things in a @supports clause in keeping with the way we currently have written the scss for .sticky-top.

Here’s a codepen: https://codepen.io/aldeng/pen/WzMGdK

Note: the codepen example doesn’t use @supports, because codepen’s env evidently doesn’t correctly expose the client browser’s support for position rules. But I’ve successfully tested the @supports mod locally, outside the codepen env.

The result looks like:

.sticky-top {
  @supports (position: sticky) or (position: -webkit-sticky) {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: $zindex-sticky;
  }
}

… plus, we have to modify the general case where the user can apply .position-sticky to any positioned element.

PR for this mod is https://github.com/twbs/bootstrap/pull/25964

1reaction
XhmikosRcommented, Jan 15, 2018

Closing as this isn’t an issue with our code but user integration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sticky-top does not work with Angular8/safari - Stack Overflow
It works fine on Chrome/Firefox, but not on Safari on Mac or iPhone. I understand that it doesn't work with Angular components, but...
Read more >
Why doesn't "position: sticky" work in Safari?
There's a CSS property called position: sticky that makes things stick to the top of the browser window (like a navbar) while scrolling....
Read more >
How to Fix Issues With CSS Position Sticky Not Working?
Learn possible reasons why CSS position sticky might not be working for you.
Read more >
CSS 'position: sticky' not working? Try 'overflow
How to make position: sticky work with an ancestor's or parent's overflow: ... Sadly, this CSS property is also not supported by Safari....
Read more >
How to make position sticky work in Safari | In The Digital
<section style="display: relative"> <div style="position: sticky; top: 150px; background: pink;"> I'm sticky </div> <div ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found