I have inherited maintenance of a mess of a project. There's a particular set of (rather tall) pages that scroll way down the page on every page load, and eventually it occurred to me that it's because a particular field is in focus after the page is loaded, and this field (of course?) was scrolled into view.
The thing is, nowhere (relevant) in the entire code base can I find the (partial) words
activat, so I really can't figure out WHY this one field is given focus!
autofocus on the first form field does not change the behaviour (although this may possibly be due to timing of scripts). I can use
myFirstInputElement.focus(), but this scrolls that field to the top of the view, and still does not show the top of the page. Trying to use
.scrollTop() has no effect.
What else might I be overlooking?
Alas, this is incredibly complicated code, with template generators and whatnot, so it is not possible to show you a condensed, minimal example exhibiting this behaviour (if I could, I could probably spot the problem myself).