This patch creates a themable function theme_confirm() which is used to confirm actions everywhere across Drupal (mostly 'delete', but e.g. used for 'reset' in the menu system too).

I also took the liberty of changing a bunch of messages to be more helpful in their wording.

A plain message looks like this:
http://acko.net/dumpx/confirm2.png (the red is from the theme)
but some messages also display more info (e.g. mass delete of nodes shows a list of titles as well).

The idea is taken from the Apple human interface guidelines: there is a large question, with some more explanation in smaller type below about what the effects might be of this action. The actions are not labeled "yes/no", but are verbs that mean something. This is much easier to end-users than trying to figure out what "Yes" is ("Are you sure you don't want to abort quitting the program and losing all your work?").

The 'cancel' item is a link rather than a button, because it does not perform an action, while the confirm button does.

The menu admin especially got some improvements (to distinguish between menus and menu items in confirmation messages) while node deletion was changed to support drupal_goto and drupal_set_message.

I discussed this patch with Chris Messina, he might do some more work on the display after 4.6, but in the meantime this patch is already a good usability and code improvement.

CommentFileSizeAuthor
#1 confirm_1.patch28.2 KBSteven
confirm_0.patch28.55 KBSteven
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Steven’s picture

FileSize
28.2 KB

Sorry the patch was still a bit dirty. Here's a better one.

Stefan Nagtegaal’s picture

Steven, you did a great job on this!

What an awesome patch.. Very clean and applies perfectly. I tested the patch (latest) and I feel very confident that this is a true *must* for drupal!

The only issue I jave with this, is that I don't like a simple link for 'cancel' and a submit-button for the true action button (aka 'Delete all posts', 'Delete all comments', 'Delete', etc, etc)

I would prefer 2 similar things, or 2 buttons, or 2 links.. But, maybe that's a personal thing..

Once again, this is _really_ a good thingtm to have.. I hope we will keep improving things the way this patch does, because then, soon the world will be Drupalised!!!

Steven’s picture

Applied to CVS/HEAD.

jhriggs’s picture

I must agree with Stefan. I do not like that the items are different. They should both be buttons...just like they would be in a dialog. The Apple HIG wouldn't say that a button shouldn't be used there. I think that canceling an action is an action. Also, I worry that the "big" text may be a bit too big in some themes.

I would really like to see that link become a button, and if I have 2 or 3 seconds to myself, I will make a patch unless someone beats me to it...

Steven’s picture

The button/link thing matches the general expectation of people on the web that links don't do anything while buttons do. I think we should keep it. Perhaps the cancel link can be moved somewhere else.

jhriggs’s picture

I see your point, but I think that the expectation is that a cancel button will cancel whatever it is the submit button would do. Reset buttons aren't links. I don't like it, but I'm just one (two with Stefan), so I'll defer to the masses.

chrismessina’s picture

I think the biggest problem is the location and size of the cancel button. It should either be to the left and spaced off a couple ems or should be below the button (less desirable).

The goal is to make it obvious that there's a potential action to be performed and that someone should seriously consider it. If they choose not to execute that action, then they do a 1 second visual search for "cancel", see it's a link and are relieved... "ah, that won't do anything! phew!"

The premise is that we're managing user expectations, as Steven suggested, by making buttons do things -- and links only navigate.

While I'm at it, here are some examples of different confirmation UIs:

Basecamp

Only local images are allowed.

Instiki

Only local images are allowed.

SmarterMail

Only local images are allowed.

chrismessina’s picture

So that must be a bug in the filter on Drupal.org, because in my post, I had image tags... and they previewed just fine. When I submitted, they vanished.

Oh well. Here are the links:

http://www.flickr.com/photos/factoryjoe/5840579/
http://www.flickr.com/photos/factoryjoe/5840758/
http://www.flickr.com/photos/factoryjoe/5822603/

Bèr Kessels’s picture

Wow, guys, you are getting too far ahead of me. While I am still working on the notes and the todolist, you guys are already fixing those todos: Great Job Steven!.

About the cancel as link: Yes, we kinda agreed on this during the sprint. And if you want a vote, you should have been there ;). Nah kidding. We weant over this pretty fast, but We did all agree that within Drupal buttons must be actions, and links bust navigate.
This /is/ best practice, but you might not feel it that way. The reason yopu might not like it, is because you have been working on desktop foo for ages now, and yes, that desktop does not use links but buttons for everything.
But we are no desktop. So please Stefan, jhriggs, reconsider your aversion against this, with the fact we are no desktop in mind.

Bèr

Steven’s picture

Status: Active » Fixed

This was committed eons ago ;).

Anonymous’s picture

Status: Fixed » Closed (fixed)