Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8308659

Use CSS scroll-margin instead of flexbox layout in API documentation

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 22
    • None
    • tools
    • None
    • b20
    • generic
    • generic

    Description

      The CSS flexbox layout introduced with JDK-8223378 has solved the problem of correct anchor scrolling with the static navigation bar, but has caused a few other problems that require workarounds, such as JDK-8249133 and follow-up bugs and now JDK-8301080.

      There is another solution to the anchor positioning problem, which is to use `sticky` CSS positioning for the navigation bar then use the `scroll-margin` property defined in the CSS Scroll Snap Module 1[1] specification to position anchor links accordingly. This solution was considered at the time but not yet supported well enough in browsers. A current reevaluation of the technology shows that it is now implemented in all supported browsers[2]. A quick tests showed it working on all desktop browsers and Safari on iOS, with the only problems showing on Chrome on Android.

      [1]: https://www.w3.org/TR/css-scroll-snap-1/
      [2]: https://caniuse.com/?search=scroll-margin

      We should consider moving from flexbox to sticky navigation + scroll-margin as soon as possible to avoid the problems and workarounds associated with the former.

      Attachments

        Issue Links

          Activity

            People

              hannesw Hannes Wallnoefer
              hannesw Hannes Wallnoefer
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: