<!DOCTYPE html>
<style>
#grid {
  display: grid;
  height: 200px;
}
#item {
  overflow: scroll;
}
#content {
  height: 800px;
}

#bar {
  display: none;
  margin-top: 200px;
}
</style>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<div id="log"></div>

<div id="grid">
  <div id="item">
    <div id="content">
      <div>foo</div>
      <div id="bar">bar</div>
    </div>
  </div>
</div>

<script>
onload = () => {
  var item = document.getElementById("item");
  item.scrollTo(0, 200);
  document.getElementById("bar").style.display = "block";
  test(() => {
    assert_equals(item.scrollTop, 200);
  }, "Checks that scroll position is kept when an element inside a grid item is showed.");
};
</script>
