backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 38 forks source link

[UX][DATA LOSS] "URL redirects" in node create/edit screen can cause lost data #2730

Open laryn opened 7 years ago

laryn commented 7 years ago

Describe your issue or idea

The "URL redirects" option in the bottom of the edit/create content screen gives no warning that it will jump to a new page. This should either give a warning to the current behavior or adapt the behavior to function on the same screen without jumping away.

Steps to reproduce (if reporting a bug)

  1. Create content, begin to type in the title, body, etc.
  2. Click on "URL redirects" and then "Add URL redirect to this node"
  3. Create and save the redirect

Actual behavior (if reporting a bug)

Expected behavior (if reporting a bug)

opi commented 6 years ago

A related issue has been fixed https://github.com/backdrop/backdrop-issues/issues/2884, but data loss issue is still present.

klonos commented 5 years ago

Wondering if we could/should be saving a draft of the node, and then redirecting back to the draft once the redirect is created.

indigoxela commented 2 years ago

Another option - open the redirect form in a dialog.

In function redirect_field_attach_form():

  if (redirect_access('create', 'redirect')) {
    $form['redirect']['actions']['#links']['add'] = array(
      'title' => t('Add URL redirect to this @type', array('@type' => backdrop_strtolower($info['label']))),
      'href' => 'admin/config/urls/redirect/add',
      'query' => array_filter($redirect) + backdrop_get_destination(),
      'attributes' => array(
        'class' => array('use-ajax'),
        'data-dialog' => 'true',
      ),
    );
  }

The redirect after form submission could get tricky, though. So I wouldn't assume my example is working without more modifications in that function.

laryn commented 2 years ago

I like the dialog option. In the alpha version of Paragraphs with front end modal editing, the edit dialog allows changes and then closes the dialog and uses Ajax to refresh just the small portion of the page that was changed. Maybe we could do something similar here where just the Redirect section gets refreshed?

laryn commented 2 years ago

Another idea: Entity Connect has links to load an add/edit form for a separate entity, while editing an entity. It saves the current page in a cache somehow, loads the new form, and then redirects back to the original form reloaded after saving the other entity. (This sounds like what @klonos suggests above)