Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Reply button not properly setting anchor and showing the editor form
Avatar
Sebastian Schimpf
Member
sp_UserOfflineSmall Offline
Aug 26, 2017 - 7:56 am

Hi there,

my client just reported that he clicks on the reply button but nothing happens. 

I did some testing and I found that sometimes if I click too quickly onto the "reply" button, there is an "accumulation" of the anchor tags in the URL:

#spEditFormAnchor#spEditFormAnchor#spEditFormAnchor#spEditFormAnchor

... and nothing happens. 

Is there any way to prevent this?
I found that the anchor is not fully reliable. This is such a vital feature. I want to make sure that people always see the editor to write a reply when they click this button. 

What do you suggest to make this more "dummy proof"?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 26, 2017 - 1:31 pm

It took some real finagling to make this happen...  it was hard to hit the button fast enough...  but I could see what you were saying because the same happens once the reply form is opened...  the anchor fragment gets added... in this case, it doesnt affect anything because you can still save...

but it tells me enough of what is going on, I think...  the reply button onclick handler probably needs cleaning up after first action...  will investigate...

*update...  was able to occasionally get it to happen...  and is consistent with my above... users will have to work hard to see this, but certainly possible... 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 26, 2017 - 4:12 pm

so have a fix...  not an easy way to get it to you though... if you are comfortable editing some js code, you can do this:

First, open up your wp-config.php file and add this line of code:

define('SP_SCRIPTS_DEBUG', true);

that will let you edit the dev scripts instead of the compressed ones...

then find file simple-press/forum/resources/jscript/sp-forum-dev.js and edit it...  around line 146, you find this code:

jQuery('#'+editorId).slideDown();
jQuery('#'+editorId).slideDown(); 
location.href = location.href + '#spEditFormAnchor'; 
spjEdOpenEditor(formType);

and then change it to:

jQuery('#'+editorId).slideDown(); 
jQuery('#'+editorId).slideDown(); 
if (!window.location.hash) location.href = location.href + '#spEditFormAnchor'; 
spjEdOpenEditor(formType);

and you should be good to go...

Avatar
Sebastian Schimpf
Member
sp_UserOfflineSmall Offline
Aug 27, 2017 - 5:20 am

Hi Mr Papa, 

thanks for figuring this out. 

You may want to consider that loading time plays a vital role in the possible occurrence of the non-functional buttons. If the editor is not fully loaded, it may happen much more easily that the anchor fragment gets added and the reply button is rendered nonfunctional. 
But to be honest, I don't understand enough about the whole structure to verify this. 

Will your code change be implemented in the next SP updates?

Avatar
Sebastian Schimpf
Member
sp_UserOfflineSmall Offline
Aug 27, 2017 - 5:26 am

I have also noticed that in case I click the reply button and scroll up to the top of the page, the next click on the button does not take me down to the message editor anymore. 
I think the interface could be coded a bit more with such things in mind. 

When I remove the #spEditFormAnchor manually from the URL in the browser address bar and I click on the reply button again, it adds "#spEditFormAnchor#spEditFormAnchor" ... and if I do it again, it will add the anchor 3 times. I think it would make sense if you change the coding and make sure the button works in any case and always triggers the jump to the form. 

Does that make sense?

Edit: The funny thing is that it works on the new topic form. 
Here I can scroll up and click again and the anchor jump works, even though the URL shows the anchor many times already:
/?new=topic#spEditFormAnchor#spEditFormAnchor#spEditFormAnchor

I don't understand this

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 27, 2017 - 3:43 pm

hmm... I cannot replicate the hash fragments growing anymore at all...

did you go to forum - toolbox - housekeeping and clear the combined js cache?  and also, I would clear the browser cache too since they hang on to dear life to cache js and css...

I can check and see - probably not too hard to make the add reply scroll to the form - as you say we do that already on the new topic...

yes, all these changes will be in the forthcoming 5.8 release...  we are probably a month or two away from that though...

Avatar
Sebastian Schimpf
Member
sp_UserOfflineSmall Offline
Aug 28, 2017 - 3:26 am

Hi Mr Papa,

I have made the changes to the JS file after changing the wp-config.php. 

Am I supposed to change it back when I uploaded the updated JS? 

I did that. 

I have also cleared the cache, of which I had no idea before you mentioned it. 

I am still facing the issue. 

https://www.biodynamicbreath.c.....-database/

You can easily test it by scrolling up again after clicking the reply button and just click onto it again. 

How can I find out if the script is actually properly updated on the server?

I found this sp-forum.js but when I open it from the forum source code it is decoded, so I can't really find my updated code. Sorry but this is a bit beyond my knowledge. 

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Aug 28, 2017 - 3:30 am

No - you need to leave the script switch in the wp-config file as instructed. This ensures that the system uses the non-minimised script files. So turn it back on and then again - clear the js cache.

When the next update comes along you can remove the switch so that the plugin again uses the minimised scripts.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Sebastian Schimpf
Member
sp_UserOfflineSmall Offline
Aug 28, 2017 - 3:36 am

So I did just that but with the same result!
Changed the wp-config, cleared all caches ... still the same. 

What am I doing wrong?

Avatar
Sebastian Schimpf
Member
sp_UserOfflineSmall Offline
Aug 28, 2017 - 3:39 am

Just tested in IE to see if it may just be a Chrome issue. 
The accumulation of anchor tags still happens. At least IE is jumping to the anchor even though it is multiplied in the url after clicking several times. 

I can't see that anything changed in the way it functions after making the change to the JS. 

 

And actually i should see this script being used, right:sp-forum-dev.js

but it is still sp-forum.js

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626