Support Forum

Reply button not properly setting anchor and showing the editor form

21 Answers

New Answer

MP Mr Papa
Mr Papa
Member

if its loading sp-forum.js and not sp-forum-dev.js, its not loading the one you modified…  please show us what you added to wp-config.php and show us where you added it…  make sure you have valid quote chars… sometimes if you copy it from formatted html you may get the wrong one… always best when copying code to use the copy raw button…

I have already coded up a enhancement for the reply button to always scroll to the form…

in the same js file, find these lines (sorry, dont have line number as I am on travel)…

                        $(‘#’ + editorId).slideDown();
                        if (!window.location.hash) location.href = location.href + ‘#spEditFormAnchor’;
                        spj.editorOpen(formType);

after those, just add:

                        $(‘html, body’).animate({scrollTop: $(‘#’ + editorId).offset().top – sp_platform_vars.headpadding}, 500);

which of course assumes you can get it to load the right file…

SS Sebastian Schimpf
Sebastian Schimpf
Member

Thanks, Mr. Papa, 

the issue was indeed my copy and paste of the code you gave me for the wp-config.php!

After i corrected the code to use proper quotes, it works. 
Thank you!

However, I think there is a weakness in the way you have coded this button feature in general.

When I scroll up, after the click on the button took me to the text editor, and I click again on the button, nothing happens. In my opinion, it would be more user-friendly if the focus would again lead the user directly to the text editor, no matter if he was there already or not. 
So I think it would be smarter to make sure the button always scrolls to the form – no matter what. 

What are your thoughts?

YS Yellow Swordfish
Yellow Swordfish
Member

Is that a browser specific problem? It certainly does what you want on our test systems in both MacOS and Windows browsers…

SS Sebastian Schimpf
Sebastian Schimpf
Member

On my Windows machine, it seems to appear in Chrome and Opera, not in IE 11 and Firefox. 

YS Yellow Swordfish
Yellow Swordfish
Member

I shall need to pass that one over to @mr-papa as I do not have a Windows PC

SS Sebastian Schimpf
Sebastian Schimpf
Member

I think it is worth considering to “fix”. I am not sure how much of an issue this is on mobile. 

The initial reason for me to post about this whole thing was that my client reported clicking on the “Add Reply” button and nothing happened. I started to play with it and found that in some cases the focus does not go to the editor and in addition to that, it does not work to go back to it (via button) when scrolling away from the editor. I observed this only in Chrome and Opera. 
Just to sum it all up. 

The accumulation of #spEditFormAnchor from clicking on the button several times is fixed. 

YS Yellow Swordfish
Yellow Swordfish
Member

Just for information – tested this under macOS on all 4 major browsers and it worked Ok on al of them. I DID have to clear the browser cache first in all cases of course.