Restoring [overflow auto] elements positions

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
maxerist
Posts: 3
Joined: September 2nd, 2012, 12:58 am

Restoring [overflow auto] elements positions

Post by maxerist »

Hi,

I noticed that Firefox (Firefox developer edition 67.0b1 (64-bit)) has a nice "feature". It remembers and restores position of div elements with "overflow auto" css style.

The problem here is that I would like to
  • control it (selectively enable for some elements and disable for others).
  • find and use this feature in other browsers. It seems this doesn't work in Chrome.
I tried to find documentation about this, but failed. I remember myself struggling to control the scroll position of overflow elements some years ago and came up with a solution using anchor names. It seems like there were some changes during this period, otherwise I would notice this feature.

The test to reproduce is the source below. Scroll to any vertical position and reload the page (F5). You will get the last scrolling position in FF and top position in Chrome

Any information would be great,
thanks

Max

Code: Select all

<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">

<style>
  .height100boxed {
    border: 1px solid rgb(150, 150, 180);
    height: 100px;
  }

  .scrollarea {
    padding: 5px;
    overflow: auto;
    width: 200px;
  }
</style>
</HEAD>

<BODY>
  <div class="scrollarea height100boxed">
    <p>test-test1</p>
    <p>test-test2</p>
    <p>test-test3</p>
    <p>test-test4</p>
    <p>test-test5</p>
  </div>
</BODY>
</HTML>
Post Reply