Closed chaconnewu closed 8 years ago
Hi @chaconnewu!
Thanks for the patch!
However I think it's a bit too complex for what we want to achieve here. We are going to add more and more state into the page, and we'll need to clear that all just to make the logo link work again. Also transforming the <a>
into a <div>
is not good for javascript-less browsers.
Wouldn't it be more simple to just update the logo link dynamically and have the page reset entirely when the user follows the link?
@sylvinus Thanks a lot for the comments and suggestions! I totally agree with you. What about the new implementation in the new commit? It pretty much follows what you described.
Great! Maybe we should do it in the eltLang.onchange
instead?
If we do it in eltLang.onchange
, the language will be reset after page is reloaded, and you have to select the dropdown again in order retain the language postfix. Putting it in eltLogo will not have this issue. Or did I misunderstand the original issue?
Right - we should also change the link in the HTML template so that the right language is in the link when the page reloads?
I used a function to set the href for logo when page load or language is selected with dropdown.
Great, thanks!
This commit approaches the issue by clearing current search states, cancelling any pending timeouts, and appending the language to the url using window.history.pushState