Make WordPress Core

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's profile 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 johnbillion)

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)

41535.patch (4.4 KB) - added by antonioeatgoat 7 years ago.
Created the common function and added some of the checks
41535.1.patch (548 bytes) - added by antonioeatgoat 7 years ago.
Simplified showNotice.warn()

Download all attachments as: .zip

Change History (12)

#1 @johnbillion
7 years ago

  • Description modified (diff)

#2 follow-up: @johnbillion
7 years ago

The online and offline events can also be used to detect a change in connectivity state. More info: https://mxb.at/blog/youre-offline/

@antonioeatgoat
7 years ago

Created the common function and added some of the checks

#3 @antonioeatgoat
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.

@antonioeatgoat
7 years ago

Simplified showNotice.warn()

#4 in reply to: ↑ 2 ; follow-up: @antonioeatgoat
7 years ago

Replying to johnbillion:

The online and offline 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 @antonioeatgoat
7 years ago

Replying to antonioeatgoat:

Replying to johnbillion:

The online and offline 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.

https://serving.photos.photobox.com/585305983f695ac7f0c8cfda330917753733829f189b3c3c0794a52a554a8ab932004ce7.jpg

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


7 years ago

This ticket was mentioned in Slack in #design by karmatosed. View the logs.


6 years ago

#8 @joyously
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 @johnbillion
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

#10 @antonioeatgoat
6 years ago

So don't you think that also the check without Gutenberg would worth? Otherwise any post type without Gutenberg would lose this feature.

Did I miss something?

Last edited 6 years ago by antonioeatgoat (previous) (diff)
Note: See TracTickets for help on using tickets.