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

Show confirmation dialog on leaving WebUI while composing #5616

Merged
merged 2 commits into from
Nov 9, 2017

Conversation

unarist
Copy link
Contributor

@unarist unarist commented Nov 7, 2017

Currently, Back button and Back hotkey can cause leaving from WebUI, as well as browser's back button. Users may hit those buttons accidentally, and their composing text will be lost.

So this prevents it by showing confirmation dialog from onbeforeunload event.

Thoughts:

  • Custom message on returnValue is only used on Edge. So maybe we can put simple text or blank string.
  • onbeforeunload can also mitigate Remain in app UI when clicking back button on a column #946 Redirect to unexpected page #3515, but I don't think it's good because 1) this may not work on mobile and some cases 2) I think it should back to Getting Started or simply ignore instead of unwanted dialog.
  • Even this case, we may want to save and load composing text silently without dialog.

Currently, Back button and Back hotkey can cause leaving from WebUI, as well as browser's back button. Users may hit those buttons accidentally, and their composing text will be lost.

So this prevents it by showing confirmation dialog from `onbeforeunload` event.
@unarist unarist added the ui Front-end, design label Nov 7, 2017

// Dummy import, to make sure that <Status /> ends up in the application bundle.
// Without this it ends up in ~8 very commonly used bundles.
import '../../components/status';

const messages = defineMessages({
beforeUnload: { id: 'ui.beforeunload', defaultMessage: 'Your composing text will be lost by leaving from Mastodon.' },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Your draft will be lost if you leave Mastodon" sounds better

@nightpool
Copy link
Member

Isn't the bigger problem when you click "reply" or something else that clears the text area? shouldn't we show the warning then?

@unarist
Copy link
Contributor Author

unarist commented Nov 9, 2017

@nightpool Ah yes, definitely. I think it can be a different PR because it would have different warning text with our confirmation modal.

@nightpool
Copy link
Member

nightpool commented Nov 9, 2017 via email

@Gargron Gargron merged commit 49a285c into mastodon:master Nov 9, 2017
@ykzts ykzts mentioned this pull request Nov 25, 2017
Gargron pushed a commit that referenced this pull request Nov 25, 2017
* yarn manage:translations

* Add Japanese translation for #5087

* Add Japanese translation for #5616

* Add Japanese translation for #5746

* Add Japanese translation for #5750
cobodo pushed a commit to cobodo/mastodon that referenced this pull request Dec 6, 2017
)

* Show confirmation dialog on leaving WebUI while composing

Currently, Back button and Back hotkey can cause leaving from WebUI, as well as browser's back button. Users may hit those buttons accidentally, and their composing text will be lost.

So this prevents it by showing confirmation dialog from `onbeforeunload` event.

* Fix message and comments
cobodo pushed a commit to cobodo/mastodon that referenced this pull request Dec 6, 2017
* yarn manage:translations

* Add Japanese translation for mastodon#5087

* Add Japanese translation for mastodon#5616

* Add Japanese translation for mastodon#5746

* Add Japanese translation for mastodon#5750
@unarist unarist deleted the feat/beforeunload branch September 29, 2018 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui Front-end, design
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants