Opened 7 years ago
Last modified 6 years ago
#41535 new feature request
Prevent or warn about offline status before submitting a form
Reported by: | johnbillion | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Administration | Keywords: | has-ux-feedback has-patch needs-testing |
Focuses: | administration | Cc: |
Description (last modified by )
For browsers that support it, the navigator.online
property reliably indicates that the browser is offline (the inverse isn't true, but it doesn't matter).
Prior to submission of a form in the admin area (for example the post editing screen form), WordPress should check the value of navigator.online
and present a prompt to the user stating that they appear to be offline. They can close the prompt or, optionally, ignore it and continue with the form submission.
This functionality would help prevent data loss when a user submits a form while they don't have an internet connection.
Attachments (2)
Change History (12)
#3
@
7 years ago
- Keywords has-patch dev-feedback added; needs-patch removed
The patch contains the common function to check the offline status and display the alert. So I added the check to post editing (creation|updating), post inline editing, menu editing (creation|updating).
It needs to be added to many places yet, I'll do it in the next days, suggestions about what forms cannot be missed are appreciated.
#4
in reply to:
↑ 2
;
follow-up:
↓ 5
@
7 years ago
Replying to johnbillion:
The
online
andoffline
events can also be used to detect a change in connectivity state. More info: https://mxb.at/blog/youre-offline/
How do you expect to use the listeners exactly? Showing an alert with "You are offline" and "You are online again" or something else?
#5
in reply to:
↑ 4
@
7 years ago
Replying to antonioeatgoat:
Replying to johnbillion:
The
online
andoffline
events can also be used to detect a change in connectivity state. More info: https://mxb.at/blog/youre-offline/
How do you expect to use the listeners exactly? Showing an alert with "You are offline" and "You are online again" or something else?
Replying to myself: the listeners could be used to trigger heartbeat-connection-lost
and heartbeat-connection-restored
, in order to show the alert and disable the submit buttons. At least where this feature already exists.
However I wouldn't remove totally the warn solution previously sent, because it is much easier to apply to all other forms.
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
6 years ago
This ticket was mentioned in Slack in #design by karmatosed. View the logs.
6 years ago
#8
@
6 years ago
- Keywords has-ux-feedback added; ux-feedback removed
For UX:
The user that is using WordPress on localhost should not be prevented from submitting even if offline, so I think the original idea of using a message on submit that the user can close and submit anyway would work best. If the submit is disabled, that is too restrictive since one of the goals of the way WordPress is packaged is that the user can work offline.
#9
@
6 years ago
- Keywords needs-testing added; dev-feedback removed
localhost isn't offline, it's a server running locally.
Although this ticket covers more than just the post editor, here's a related Gutenberg issue: https://github.com/WordPress/gutenberg/issues/6322
The
online
andoffline
events can also be used to detect a change in connectivity state. More info: https://mxb.at/blog/youre-offline/