New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mainFocus() call in app.js prevents jumping to url anchor on page refresh #1082
Comments
update: it turns out this only happens on refresh... which is my common use case as i'm getting used to yard (change some doc source, hit refresh in the browser). so it might be a little more complicated than i first assumed, and could be a browser / environment specific issue (though i would guess Chrome on OSX is pretty common for software developers). |
This was probably used when frames were a thing. I don't think we'd need this anymore. If taking this out looks like it does not cause any other issues I would look at a PR for this. |
Actually, looking at this further, this seems to be necessary-- removing mainFocus() will break keyboard accessibility, i.e., pressing down to scroll the page. This could probably be fixed by changing CSS (I believe the full body has overflow off and the real scroll happens in #main) but that would require more wrangling than simply removing a JS call. |
Can be solved with JS, too. |
I'd just like to note that this is still broken for me, if I refresh a documentation page. |
Ok so before I posted my last comment, I updated yard, regenerated the documentation, restarted the yard server, reloaded the page including cache and it did not work. |
I had hoped that this fixed #1071 - but unfortunately that wasn't the case. Though this thread gives some better clues to where its happening. Something I never found. |
when you refresh a url like
http://www.rubydoc.info/gems/cmds/Cmds#capture-class_method
the browser doesn't jump to the
#capture-class_method
anchor.this appears to be due to the
$('#main')[0].focus();
call inmainFocus()
at app.js which is fired when the document is ready, jumping focus to the top of the page.when i comment out the
mainFocus()
call it works fine in my local environment. what's that call there for? could i add a subsequent call to focus on the anchor from the url if one is present?it's my guess that this is the cause of #1071 as well.
Steps to reproduce
go to any yard doc page and click on a method link, then hit refresh.
Actual Output
page reloads at top.
Expected Output
page reloads at method anchor.
Environment details:
ruby -v
): 2.3.3yard -v
): 0.9.8The text was updated successfully, but these errors were encountered: