Node form default action does not match visual cues

Created on 12 August 2024, 3 months ago
Updated 27 August 2024, 3 months ago

Not sure if I'd be so bold as to call this a "bug", but it is certainly bugging me.

Commit #75a357b8 (Save button order) added the following:

// Put Save after Preview.
$save_weight = $form['actions']['preview']['#weight'] ? $form['actions']['preview']['#weight'] + 1 : 11;
$form['actions']['submit']['#weight'] = $save_weight;

This change in weight results in the Preview button being rendered before the Save button. The side effect of this is the Preview button, being the first submit button rendered in the form, becomes the default action.

Maybe I need to adjust my expectations but when I see a blue Save button, I expect that to be the default action.

For anyone using a mouse I don't see this as being much of an issue, but anyone using a keyboard, or I suspect assistive devices, this could be a pain point.

The way I see it there are a few ways forward:

  1. Swap them back to Save before Preview
  2. Move the button--primary class to the preview button
  3. Re-order client-side with CSS, rather than server-side
  4. …
  5. Leave it as-is and close this issue as "works as designed"

</rant>

πŸ› Bug report
Status

Fixed

Version

3.0

Component

User interface

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ulethjay
  • Status changed to Closed: works as designed 3 months ago
  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

    (mambo) Nr. 5 it is!

    From a UX flow perspective it makes sense to have Preview before Save as you potentially want to Preview before you Save and not vice versa. Presenting the button after the Save action might also mean that assistive tech users never get to it (as they potentially assume the Save action is the last option).

    Also this has been this way for many years so for sure nothing we would change for the 3.0 stable release which is pending.

    I see your point though, so there is a bit a pro/con to both solutions.

    I'll close this as works as designed for now, but we might reopen it in the future.

    Thanks for sharing.

    Cheers!

  • Wow that was fast.

    I forgot to mention why I even brought this up in the first place.

    We're a University with ~200 users able to add / edit content. Naturally their familiarity, comfort level, technical prowess, etc. varies wildly. We've asked a number of these users to kick the tires on the D10 replacement we've been working on.

    We had a couple users report that their changes weren't being saved. When we watched one of them edit a node title and press "Enter" they were brought to the preview page. This user had no idea that is was a preview page and just assumed that their edit would have been saved, because in their mind that's how things work in D7. And as far as I know, the default in D10 also is to Save.

    Anyways…

    Personally, I'm fine with the ticket being closed. I'm in the fortunate position of not needing to worry about how a change here might effect the users of the other 55,000 sites gin has been installed on and have swapped the behaviour back with a hook_form_alter.

    Thanks for your time.

  • Status changed to Fixed 3 months ago
  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

    We had a couple users report that their changes weren't being saved. When we watched one of them edit a node title and press "Enter" they were brought to the preview page. This user had no idea that is was a preview page and just assumed that their edit would have been saved, because in their mind that's how things work in D7. And as far as I know, the default in D10 also is to Save.

    I checked this and you're 100% correct, this is broken. Let's push a fix to change the order as a boring solution and if we don't get any bigger complaints we can leave it. Otherwise we'd need to handle it via JS which is not so nice as letting the browser doing it's thing it's supposed to do.

    Sorry for being very fast in closing here in the first place.

  • That's awesome. Thank you for that.

    I removed my hook_form_alter and gave commit abce0b5f a quick run through and the Save button appears first and is the default submit button when adding and editing nodes.

    Looks good to me.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024