Last modified: 2012-12-31 14:22:09 UTC
(In reply to Bug 27488 comment #28) > Following a link to a section in long discussion page: > > * Click the link. > * Wait for the page to appear (takes a while since the pages are not cached for > users who are logged in) > * Notice that you have been sent to a different location. No section header > anywhere near. > * Try to locate the right position anyway. > * If you can't find it, click the url bar and press Enter. (Maybe the Reload > button also does it in some browsers.) Maybe the script resources/jquery/jquery.makeCollapsible.js (the function toggleLinkPremade?) could memorize the current scroll position and restore it right after collapsing an element in the page (I think LQT does something like that). This could help if the element is one of those which are above the current section (currently you may end up a few sections below the one you wanted)
That would be one way to work around it pushing down the page, however this will be fixed in the refactor of jquery.makeCollapsible which will do the initial collapse with CSS instead of JavaScript (so by the time the browser even considers jumping to a position, the collapsing has been long taken care of). This works because CSS applies retroactively and live. So when the html comes into the parser and is rendered by the browser, the state of expansion or collapse is already applied from the start, no transition. (this does use javascript, but not inside jquery.makeCollapsible, it will use .client-js .mw-collapsed)
I think that CSS solution would not work for the case where someone is adding the class="mw-collapsible mw-collapsed" from a user script and calling $(...).makeCollapsible()
(In reply to comment #2) > I think that CSS solution would not work for the case where someone is adding > the class="mw-collapsible mw-collapsed" from a user script and calling > $(...).makeCollapsible() In that case the element would collapse as soon as the class is added. Calling makeCollapsible will then add the relevant event handlers so that the user can change the state. Note that if javascript is disabled it will always be shown even if CSS hides it with mw-collapsed because the selector would be prefixed with .client-js (which the mw.page module adds to the document).