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

Some actions (Stop Timer/Assign/Label/Milestone ... ) on issue page will make page reload and lose unsaved content, autosave draft or ajax #17705

Open
aschrijver opened this issue Nov 18, 2021 · 5 comments
Labels
topic/ui Change the appearance of the Gitea UI

Comments

@aschrijver
Copy link

Feature Description

This is a feature request to avoid users (like myself) from stupidity.

I just started using the Timer in the Issue Tracker, and - not being used to it - pressed "Stop Timer" a number of times, while I was still editing the issue text. Forgot to press "Save". This caused all my work to be lost (happened just now after typing a very long text). Also pressing the browser "Back" button (Firefox) did not lead back to edit-mode view, but to the Project Board from which I opened the issue.

The Gitea UI could prevent this from happening by either showing a dialog "You are currently editing. Continue? Yes/No", or committing the changes by handling the "Save" action automatically with "Stop Timer" button press.

Screenshots

No response

@lunny lunny added the topic/ui Change the appearance of the Gitea UI label Nov 18, 2021
@aschrijver
Copy link
Author

Note that there are more ways to lose text, that Gitea may or may not be able to protect the user against. Like when you press 'Edit' and update a text, then - without saving - suspend the computer, restart it later and press 'Save'. All updated text will be lost without warning.

@lunny
Copy link
Member

lunny commented Nov 22, 2021

Hm, should we store it in Local Storage of web browser?

@wxiaoguang wxiaoguang changed the title Warn of unsaved work when pressing "Stop Timer" or auto-save Some actions (Stop Timer / Assign/ ... ) on issue page will make page reload and lose unsaved content, autosave draft or ajax Jun 24, 2022
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jun 24, 2022

press 'Edit' and update a text, then - without saving - suspend the computer, restart it later and press 'Save'. All updated text will be lost without warning.

This is another problem and it should have been fixed, it's related CSRF token generation, and sometimes caused by misconfigured session/cookie.


Autosave (draft) could be related to


To make the web UI friendly, some possible solutions:

  1. use AJAX as much as possible (then no page reload, no lost)
  2. use Autosave(Draft)
  3. use a warning dialog (not that friendly, I would prefer 1 or 2)

@wxiaoguang wxiaoguang changed the title Some actions (Stop Timer / Assign/ ... ) on issue page will make page reload and lose unsaved content, autosave draft or ajax Some actions (Stop Timer/Assign/Label/Milestone ... ) on issue page will make page reload and lose unsaved content, autosave draft or ajax Jul 5, 2022
lunny added a commit that referenced this issue Feb 24, 2023
)

As the title. Label/assignee share the same code.

* Close #22607
* Close #20727

Also:

* partially fix for #21742, now the comment reaction and menu work with
keyboard.
* partially fix for #17705, in most cases the comment won't be lost.
* partially fix for #21539
* partially fix for #20347
* partially fix for #7329

### The `Enter` support

Before, if user presses Enter, the dropdown just disappears and nothing
happens or the window reloads.

After, Enter can be used to select/deselect labels, and press Esc to
hide the dropdown to update the labels (still no way to cancel ....
maybe you can do a Cmd+R or F5 to refresh the window to discard the
changes .....)


This is only a quick patch, the UX is still not perfect, but it's much
better than before.


### The `confirm` before reloading

And more fixes for the `reload` problem, the new behaviors:

* If nothing changes (just show/hide the dropdown), then the page won't
be reloaded.
* If there are draft comments, show a confirm dialog before reloading,
to avoid losing comments.

That's the best effect can be done at the moment, unless completely
refactor these dropdown related code.

Screenshot of the confirm dialog:

<details>


![image](https://user-images.githubusercontent.com/2114189/220538288-e2da8459-6a4e-43cb-8596-74057f8a03a2.png)

</details>

---------

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
yardenshoham pushed a commit to yardenshoham/gitea that referenced this issue Feb 24, 2023
…gitea#23014)

As the title. Label/assignee share the same code.

* Close go-gitea#22607
* Close go-gitea#20727

Also:

* partially fix for go-gitea#21742, now the comment reaction and menu work with
keyboard.
* partially fix for go-gitea#17705, in most cases the comment won't be lost.
* partially fix for go-gitea#21539
* partially fix for go-gitea#20347
* partially fix for go-gitea#7329

### The `Enter` support

Before, if user presses Enter, the dropdown just disappears and nothing
happens or the window reloads.

After, Enter can be used to select/deselect labels, and press Esc to
hide the dropdown to update the labels (still no way to cancel ....
maybe you can do a Cmd+R or F5 to refresh the window to discard the
changes .....)


This is only a quick patch, the UX is still not perfect, but it's much
better than before.


### The `confirm` before reloading

And more fixes for the `reload` problem, the new behaviors:

* If nothing changes (just show/hide the dropdown), then the page won't
be reloaded.
* If there are draft comments, show a confirm dialog before reloading,
to avoid losing comments.

That's the best effect can be done at the moment, unless completely
refactor these dropdown related code.

Screenshot of the confirm dialog:

<details>


![image](https://user-images.githubusercontent.com/2114189/220538288-e2da8459-6a4e-43cb-8596-74057f8a03a2.png)

</details>

---------

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
lunny added a commit that referenced this issue Feb 24, 2023
) (#23102)

Backport #23014

As the title. Label/assignee share the same code.

* Close #22607
* Close #20727

Also:

* partially fix for #21742, now the comment reaction and menu work with
keyboard.
* partially fix for #17705, in most cases the comment won't be lost.
* partially fix for #21539
* partially fix for #20347
* partially fix for #7329

### The `Enter` support

Before, if user presses Enter, the dropdown just disappears and nothing
happens or the window reloads.

After, Enter can be used to select/deselect labels, and press Esc to
hide the dropdown to update the labels (still no way to cancel ....
maybe you can do a Cmd+R or F5 to refresh the window to discard the
changes .....)


This is only a quick patch, the UX is still not perfect, but it's much
better than before.


### The `confirm` before reloading

And more fixes for the `reload` problem, the new behaviors:

* If nothing changes (just show/hide the dropdown), then the page won't
be reloaded.
* If there are draft comments, show a confirm dialog before reloading,
to avoid losing comments.

That's the best effect can be done at the moment, unless completely
refactor these dropdown related code.

Screenshot of the confirm dialog:

<details>


![image](https://user-images.githubusercontent.com/2114189/220538288-e2da8459-6a4e-43cb-8596-74057f8a03a2.png)

</details>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@lunny
Copy link
Member

lunny commented Apr 4, 2023

Should be fixed by #23895

@wxiaoguang
Copy link
Contributor

Nope, wait for other steps in:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

No branches or pull requests

3 participants