Skip to content
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

"Are you sure you want to leave?" is asked even for search queries #3698

Closed
Treora opened this issue Mar 20, 2018 · 2 comments · Fixed by #3707
Closed

"Are you sure you want to leave?" is asked even for search queries #3698

Treora opened this issue Mar 20, 2018 · 2 comments · Fixed by #3707
Labels
type/enhancement An improvement of existing functionality type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@Treora
Copy link
Contributor

Treora commented Mar 20, 2018

  • Gitea version (or commit ref): 43fc430

Description

Gitea uses jquery.are-you-sure to help users not lose data when they have edited a form. This is currently done on every form, see here. On inputs such as search queries, popping up this dialog seems both annoying and may cause needless what-did-I-do-wrong stress.

Reproduce

Go to any page with a search bar. Type some letters in the search query. Navigate to another page (without searching). You'll get a prompt asking if you are really sure about leaving this page.

Possible solutions

Either:

  • tell jquery.are-you-sure to ignore the search query inputs (and possibly other unimportant fields) by adding class="ays-ignore"
  • or the other way around, add a class to all forms that do need to be warned about when modified, and enable areYouSure only for forms of that class.

Any preference for either solution?

@lafriks
Copy link
Member

lafriks commented Mar 20, 2018

Best solution would probably be to add ignore, that would be more error prone also in future

@lafriks lafriks added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Mar 20, 2018
@Treora
Copy link
Contributor Author

Treora commented Mar 22, 2018

@lafriks PR #3707 implements the solution that makes ignoring explicit.
Slightly different from what I proposed, I ended up adding a class ignore-dirty to the forms, instead of adding ays-ignore to every input.

@lunny lunny added the type/enhancement An improvement of existing functionality label Mar 22, 2018
lunny pushed a commit that referenced this issue Mar 23, 2018
The choice regarding which forms should or should not trigger a warning
is subjective. I tried to be consistent and not warn about forms that:
 - run an action, rather than edit data: search, send an email.
 - delete data: a warning about losing data would be confusing

Note that forms on sign-in pages were already ignored (using a selector,
rather than an explicit class on the form element).

Fixes #3698.
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants