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

'Do you want to leave this site?' message appears when no edits have been made, when using certain fieldtypes #1559

Closed
anthubbard opened this Issue Aug 18, 2017 · 7 comments

Comments

Projects
None yet
5 participants
@anthubbard

anthubbard commented Aug 18, 2017

In the CP there is a warning that pops up if you try to exit a page when you have edited something but haven't saved.

**Do you want to leave this site?**
Changes that you made may not be saved.

This is a great feature and has saved my bacon on several occasions - however there is an annoying facet to this function in that is seems to occur if you scroll on a page or focus on a field even if you haven't made an edit.

Personally I think only an edit on the page should cause the warning to occur, NOT scrolling or focusing on a field, otherwise it is really annoying.

I have had clients tell me this annoys them a lot, and it has annoyed me quite a bit whilst developing.

@anthubbard anthubbard changed the title from Do you want to leave this site message appears when no edits have been made to 'Do you want to leave this site?' message appears when no edits have been made Aug 18, 2017

@rrelmy

This comment has been minimized.

rrelmy commented Aug 18, 2017

Could be related to #1480

I also just realized that the warning is triggered when focusing my charfield (issue)

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Aug 18, 2017

We only enable the popup when something does change. So, something might unintentionally be getting changed. Perhaps when a field is loaded. Can you show me a fieldset where this is happening?

@FR6

This comment has been minimized.

FR6 commented Aug 18, 2017

@jasonvarga You are right, it works properly with the demo fieldsets.

I find out that it triggers the alert when there is specifically an Assets field and there is a scroll in the page:

image

@jasonvarga jasonvarga changed the title from 'Do you want to leave this site?' message appears when no edits have been made to 'Do you want to leave this site?' message appears when no edits have been made, when using certain fieldtypes Aug 18, 2017

@rrelmy

This comment has been minimized.

rrelmy commented Aug 20, 2017

I can not reproduce the scrolling issue but I did reproduce a general problem that maybe related to this issue.

If you focus an empty text field the data property of the component changes from null to empty string which triggers the changesMade event.

Steps to reproduce

  1. Open a fieldset with an empty Create Title
  2. Focus the field
  3. Navigate away and see the alert
@edalzell

This comment has been minimized.

edalzell commented Aug 22, 2017

I see this on an addon settings page when I have custom suggest modes

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Aug 22, 2017

I've fixed this in a branch. Haven't labeled this issue as pending release because I don't know if it will be the next one or not.

However, it's fixed. Will be released eventually.

@anthubbard

This comment has been minimized.

anthubbard commented Aug 22, 2017

\o/

💃

Jason Varga, you are amazing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment