<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true IOSFormControlRefreshEnabled=true ] -->
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <script src="../../../../../resources/js-test.js"></script>
        <script src="../../../../../resources/ui-helper.js"></script>
    </head>
<body>
<input id="text">
<br>
<select id="select">
    <option>A</option>
    <option>B</option>
    <option>C</option>
</select>
<div style="margin-top: 2000px;" id="bottom">Bottom</div>
</body>
<script>
jsTestIsAsync = true;

addEventListener("load", async () => {
    description("This test verifies that tapping on a text input and then tapping on a select element does not unexpectedly change the scrolling position.");

    await UIHelper.activateElement(text);
    await UIHelper.activateElement(select);
    await UIHelper.waitForContextMenuToShow();
    await UIHelper.selectFormAccessoryPickerRow(0);
    await UIHelper.waitForContextMenuToHide();

    shouldBeEqualToNumber("document.scrollingElement.scrollTop", 0);

    bottom.remove();
    finishJSTest();
});
</script>
</html>
