When using the multiple
attribute, the page when loaded loads the last <select/>
that contains a option
with the selected
attribute:
<p>No Google Chrome a página não fica aqui...</p>
<form style="padding-top:1000px;">
<p>No Google Chrome desliza para aqui...</p>
<select multiple="multiple">
<option selected="selected">1</option>
<option>2</option>
</select>
</form>
form{
padding-top:1000px;
}
<p>No Google Chrome a página não fica aqui...</p>
<form>
<p>No Google Chrome desliza para aqui...</p>
<select multiple="multiple">
<option selected="selected">1</option>
<option>2</option>
</select>
</form>
This same problem is also reported for Chromium although the indication is that it appears only in some versions:
- Issue 423256: Select elements cause automated scroll on page load
- Issue 426919: Page scrolls to select with multiple attribute on load if it contains a selected option.
Question
How can I work around this problem so that the website has the same behavior in all browsers?
Tests where the problem does not occur:
- Chromium Version 37.0.2062.120 Built on Ubuntu 14.04, running on LinuxMint 17 (64-bit)
- Mozilla firefox 32.0.3 for Linux Mint - mint - 1.0
- Internet Explorer 11 - Version 11.0.9600.17351 - Update 11.0.13 running on Windows 8.1
Successful bug playback:
- Google Chrome - Version 38.0.2125.111 m running on Windows 8.1