Dnn.Platform icon indicating copy to clipboard operation
Dnn.Platform copied to clipboard

Keep Module edit cursor in place and stop it jumping back to top of page after edit

Open James-Robertson777 opened this issue 2 years ago • 20 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description of problem

I have a very large DNN website which is extemely content heavy and I am currently creating webpages with up to about 30 html modules each with around 3 A4 pages of text

Most of the time when I edit a module the cursor jumps to the top of the page and i then have to scroll down to where i was working which is tedious given the number of modules I need to scroll past

When i add a new html module the cursor remains in place so there is clearly no reason why it has to go back to the top

Is there a patch or add-in that fixes this?

Description of solution

Keep the cursor in place after a module edit

Description of alternatives considered

Cannot see any other option

Anything else?

The cursor remains in place after a module add but not after a module edit so the code apparently already exists

Do you be plan to contribute code for this enhancement?

  • [ ] Yes

Would you be interested in sponsoring this enhancement?

  • [x] Yes

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

James-Robertson777 avatar Oct 26 '23 18:10 James-Robertson777

I am confused, when you say cursor, are you talking about the mouse cursor, the text cursor or the scroll position within the page. I am not understanding this issue...

valadas avatar Oct 26 '23 19:10 valadas

FYI - This is also reported and discussed in the DNN Community Forums.

WillStrohl avatar Oct 26 '23 19:10 WillStrohl

The page reloads in a way that doesn't help continue the content editing workflow experience. You have to navigate back to the module/element you were previously working on.

WillStrohl avatar Oct 26 '23 19:10 WillStrohl

So we are talking about the scroll position within the page right, to bring back to the same scroll position as the module that was just edited. I am understanding correctly ?

valadas avatar Oct 26 '23 21:10 valadas

As I understand it, yes, to returning the page to the point at which the reload action was triggered. Right, @James-Robertson777?

WillStrohl avatar Oct 26 '23 21:10 WillStrohl

Yes, that is correct

I will record a video tomorrow to show exactly what I am experiencing.

Thank you so much for your interest and help :)

James-Robertson777 avatar Oct 27 '23 18:10 James-Robertson777

Hi there

I have recorded a video showing exactly what my pain points are, it is too large to attach so in Dropbox at

https://www.dropbox.com/scl/fi/9j6200nm6ayinuekfrlwb/2023_10_28_Recording_of_issues_with_DNN_adding_html_modules_James_Robertson.mp4?rlkey=h4pzgpi9e1d920qcamo1nzyyt&dl=0

Thank you so much for your help.

James-Robertson777 avatar Oct 28 '23 09:10 James-Robertson777

Also when I click on the pencil icon on the left hand margin to edit the page returns to the top as well

James-Robertson777 avatar Oct 28 '23 15:10 James-Robertson777

Is there any possibility of creating a small patch for this or add-in or similear?

I can afford to pay for a couple of hours to do this if that will help

James-Robertson777 avatar Oct 30 '23 19:10 James-Robertson777

I have a feeling this may have been caused by #5818 @James-Robertson777 can you confirm if this started happening with a specific version of DNN ?

valadas avatar Oct 30 '23 19:10 valadas

Hi Valadas

I am not sure if this started recently, until about six weeks ago I typically only posted one html module on a page so it was not too much of an issue so did not pay attention

It is only the last six weeks or so where i have been inserting up to 30 html modules on a page that it has become a real nuisance

So it could have been there for years or could have been only a short while and I would not have noticed

Apologies for not being clearer.

James-Robertson777 avatar Oct 31 '23 09:10 James-Robertson777

Hi Erwin Yulianto

Regret I am completely non-technical, I do not know what to do with the code snippet you have sent.

I could perhaps get my Internet Service provider to install this but would need some guidance as to where it should be inserted.

Sorry to be difficult ☹

Thank you for your help 😊

From: Erwin Yulianto @.> Sent: Monday, October 30, 2023 8:14 PM To: dnnsoftware/Dnn.Platform @.> Cc: James-Robertson777 @.>; Mention @.> Subject: Re: [dnnsoftware/Dnn.Platform] Keep Module edit cursor in place and stop it jumping back to top of page after edit (Issue #5849)

Hi @James-Robertson777 https://github.com/James-Robertson777 This might be a temporary solution from here https://stackoverflow.com/questions/17642872/refresh-page-and-keep-scroll-position that you can use.

— Reply to this email directly, view it on GitHub https://github.com/dnnsoftware/Dnn.Platform/issues/5849#issuecomment-1785963040 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BDQ4OQKU7OHDDXGZ6HMFDK3YCAC7TAVCNFSM6AAAAAA6RUAEMWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBVHE3DGMBUGA . You are receiving this because you were mentioned. https://github.com/notifications/beacon/BDQ4OQM4IDVX7D7INNIG5ITYCAC7TA5CNFSM6AAAAAA6RUAEMWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTKOORCA.gif Message ID: @.*** @.***> >

James-Robertson777 avatar Oct 31 '23 09:10 James-Robertson777

Hi @James-Robertson777 I'm sorry for deleting my previous comment because I see a problem that it will only work when page refresh. After Edit Content, it read window.ScrollY position back to 0.

I've modify the script so it will work event after you Edit Content:

<script>
    document.addEventListener("DOMContentLoaded", function (event) {
        var scrollpos = sessionStorage.getItem('scrollpos');
        if (scrollpos) {
            window.scrollTo(0, scrollpos);
            sessionStorage.removeItem('scrollpos');
        }
    });

    window.addEventListener("beforeunload", function (e) {
		if (window.scrollY !== 0)
			sessionStorage.setItem('scrollpos', window.scrollY);
    });
</script>

You can place this code on Page Settings > SEO > Page header tags image

Hopefully it can solve your problem temporary.

erw13n avatar Oct 31 '23 16:10 erw13n

It is only the last six weeks or so where i have been inserting up to 30 html modules on a page that it has become a real nuisance

So it could have been there for years or could have been only a short while and I would not have noticed

I'm pretty sure it's always been there. I've also seen this over the years, but never really thought it was annoying anyone but me. 😆

WillStrohl avatar Oct 31 '23 16:10 WillStrohl

Thank you Erwin

Why do you say “Temporarily”?

What will cause it to reverse?

From: Erwin Yulianto @.> Sent: Tuesday, October 31, 2023 4:49 PM To: dnnsoftware/Dnn.Platform @.> Cc: James-Robertson777 @.>; Mention @.> Subject: Re: [dnnsoftware/Dnn.Platform] Keep Module edit cursor in place and stop it jumping back to top of page after edit (Issue #5849)

Hi @James-Robertson777 https://github.com/James-Robertson777 I'm sorry for deleting my previous comment because I see a problem that it will only work when page refresh. After Edit Content, it read window.ScrollY position back to 0.

I've modify the script so it will work event after you Edit Content:

You can place this code on Page Settings > SEO > Page header tags https://user-images.githubusercontent.com/792847/279452982-d24bbbd1-179b-42d2-90ab-77fbe3ceebd4.png

Hopefully it can solve your problem temporary.

— Reply to this email directly, view it on GitHub https://github.com/dnnsoftware/Dnn.Platform/issues/5849#issuecomment-1787600995 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BDQ4OQLTIKZ4JNGEAQKWSWLYCETW5AVCNFSM6AAAAAA6RUAEMWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBXGYYDAOJZGU . You are receiving this because you were mentioned. https://github.com/notifications/beacon/BDQ4OQMTXUHCBWPLNJLZYCDYCETW5A5CNFSM6AAAAAA6RUAEMWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTKRSQGG.gif Message ID: @.*** @.***> >

James-Robertson777 avatar Oct 31 '23 18:10 James-Robertson777

Thank you Will

From: Will Strohl @.> Sent: Tuesday, October 31, 2023 4:53 PM To: dnnsoftware/Dnn.Platform @.> Cc: James-Robertson777 @.>; Mention @.> Subject: Re: [dnnsoftware/Dnn.Platform] Keep Module edit cursor in place and stop it jumping back to top of page after edit (Issue #5849)

It is only the last six weeks or so where i have been inserting up to 30 html modules on a page that it has become a real nuisance

So it could have been there for years or could have been only a short while and I would not have noticed

I'm pretty sure it's always been there. I've also seen this over the years, but never really thought it was annoying anyone but me. 😆

— Reply to this email directly, view it on GitHub https://github.com/dnnsoftware/Dnn.Platform/issues/5849#issuecomment-1787608338 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BDQ4OQPTEFUNX6G2K3C4HMTYCEUHZAVCNFSM6AAAAAA6RUAEMWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBXGYYDQMZTHA . You are receiving this because you were mentioned. https://github.com/notifications/beacon/BDQ4OQIC34J5RPYEH5TIWJTYCEUHZA5CNFSM6AAAAAA6RUAEMWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTKRS6RE.gif Message ID: @.*** @.***> >

James-Robertson777 avatar Oct 31 '23 18:10 James-Robertson777

My ISP is overloaded at present and it could take three or four weeks before they can install the script

Is there anyone here who could do this, i have the administrator password and happy to pay, this is really causing me quite a bit of inconvenience

Thanks all for your input

James-Robertson777 avatar Oct 31 '23 18:10 James-Robertson777

@James-Robertson777 I'm not sure that should be your permanent solution. Ideally, that code should get vetted by others here, and the final version added to DNN itself.

WillStrohl avatar Oct 31 '23 20:10 WillStrohl

Thank you Will, understood.

@James-Robertson777 https://github.com/James-Robertson777 I'm not sure that should be your permanent solution. Ideally, that code should get vetted by others here, and the final version added to DNN itself.

James-Robertson777 avatar Nov 01 '23 13:11 James-Robertson777

Erwin installed the script and its working, thanks Erwin, Will and others on the board who helped :)

James-Robertson777 avatar Nov 04 '23 14:11 James-Robertson777