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

Closed
opened 2025-11-02 04:08:04 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @Treora on GitHub (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?

Originally created by @Treora on GitHub (Mar 20, 2018). - Gitea version (or commit ref): 43fc430 ## Description Gitea uses [jquery.are-you-sure](https://plugins.jquery.com/are-you-sure/) to help users not lose data when they have edited a form. This is currently done on *every* form, see [here](https://github.com/go-gitea/gitea/blob/43fc430c078d61cf7ab428c3cf0e07eeebd0445e/public/js/index.js#L1667). 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?
GiteaMirror added the type/proposaltype/enhancement labels 2025-11-02 04:08:04 -06:00
Author
Owner

@lafriks commented on GitHub (Mar 20, 2018):

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

@lafriks commented on GitHub (Mar 20, 2018): Best solution would probably be to add ignore, that would be more error prone also in future
Author
Owner

@Treora commented on GitHub (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.

@Treora commented on GitHub (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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1639