Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move title of confirm form to a backdrop message #6733

Open
robertgarrigos opened this issue Oct 18, 2024 · 23 comments · May be fixed by backdrop/backdrop#4889
Open

Move title of confirm form to a backdrop message #6733

robertgarrigos opened this issue Oct 18, 2024 · 23 comments · May be fixed by backdrop/backdrop#4889

Comments

@robertgarrigos
Copy link

robertgarrigos commented Oct 18, 2024

Description of the need

I always found strange that the confirm form function sets the title of the page. This issue made me think about a practical solution to override this functionality. However, I would say it would be much better to change core.

Proposed solution

This is what happens now. The demonstration contrib module uses tabs:

Snapshots___My_Backdrop_Site_-_Vivaldi
Snapshots___My_Backdrop_Site_-_Vivaldi

These two tabs show the title normally, but the third one is a confirm form:

Snapshots___My_Backdrop_Site_-_Vivaldi

and the title gets changed. Of course, you can still see the context in the breadcrumb, but what happens if you don't use the breadcrumb? Context indeed gets lost.

Wouldn't it be much nicer this?:

Snapshots___My_Backdrop_Site_-_Vivaldi

Alternatives that have been considered

I don't see an easy way to accomplish this functionality by altering code with a contrib module.

Additional information

I will provide a PR

Draft of feature description for Press Release (1 paragraph at most)

Confirm forms now show the title as a warning backdrop message.

@robertgarrigos
Copy link
Author

This is how a blank backdrop works with this pr:

Your_first_post____Backdrop_-_Vivaldi

Instead of:

Are_you_sure_you_want_to_delete_Your_first_post_____Backdrop_-_Vivaldi

@izmeez
Copy link

izmeez commented Oct 18, 2024

This is fantastic. Looks good, much better. PR works and the code is a one line change. Now, what bad things can happen? I don't know.

@izmeez
Copy link

izmeez commented Oct 18, 2024

The PR also fixes the issue for the demo module, backdrop-contrib/demo#32. It will change behaviour contrib modules are used to and may be a problem? Or may be an overall improvement?

@izmeez
Copy link

izmeez commented Oct 18, 2024

This issue may be really ancient and extends back to Drupal 7. If you go to a Drupal 7 site with something like the backup_migrate module, look at saved backups and go to delete one. The confirm question message shows in place of the title.

@izmeez
Copy link

izmeez commented Oct 18, 2024

Here is how this core fix improves the current backdrop-contrib/backup_migrate delete saved backup display.
Before patch:
bam-current-delete-confirm-screenshot

After patch:
bam-core-patched-delete-confirm-screenshot

Both before and after show the wrong tab menu highlighted, so that's a separate issue for bam.

@izmeez
Copy link

izmeez commented Oct 18, 2024

Maybe, this can qualify as a bug fix?

@indigoxela
Copy link
Member

indigoxela commented Oct 20, 2024

I'm not really sure, whether this change isn't an A11Y regression.

Instead of providing the info in the page title AND the meta title for quick access, it's now just some text somewhere on the page. And the page title is the generic title of the content or item we're about to delete. No A11Y expert, though.

At the very minimum I'd expect the title to be something like "Confirm to delete [title of item]". Not sure if that would be sufficient.

@avpaderno
Copy link
Member

avpaderno commented Oct 20, 2024

What I find more confusing on these screenshots is the fact the tab/sub-tab is still showed as active.

screenshot

screenshot

When I deleted a node, the title is changed, but none of the visible tabs is shown as active.

screenshot

Should not what done by Backdrop core when deleting a node be always done when a confirmation page is shown?

@avpaderno
Copy link
Member

avpaderno commented Oct 20, 2024

When deleting a view from the page showing all the existing views, the tabs disappear.

screenshot

They disappear because the page changes from /admin/structure/views/list to /admin/structure/views/view/<view machine name>/delete and the latter does not have any tab. (In the case of nodes, the page changes from /node/<node ID>/edit to /node/<node ID>/delete.)

Even in this case, the title change is not confusing, since the page is clearly another one.

@indigoxela
Copy link
Member

What I find more confusing on this screenshot is the fact the sub-tab is still showed as active.

@avpaderno is this something directly related to the change proposed here, or an independent (new) topic?

@robertgarrigos
Copy link
Author

What @avpaderno is talking about has nothing to do with the changed proposed here. I just changed one backdrop_set_title() for a backdrop_set_message(). Tab functionality has not been changed.

@avpaderno
Copy link
Member

avpaderno commented Oct 20, 2024

@avpaderno is this something directly related to the change proposed here, or an independent (new) topic?

I am talking of the screenshots shown right after Proposed solution and in another comment (which shows the before-and-after changes), so yes, it is related to the change proposed here.

I am wondering if this is an issue with a contributed module because, as I shown in the screenshots attached to my previous comments, there is no issue with Backdrop core and the fact the page title is changed.

@robertgarrigos
Copy link
Author

@avpaderno, yes, this is just how those contrib modules handle those tabs. Core's behavior is as you have shown, but again, this PR has nothing to do with how core or contrib modules handle the tabs, even I used them to explain the problem.

However, I got the point that I have to take a wider look at this issue, also, as @indigoxela pointed out, from an A11Y perspective. I agree that having just the same title is not clear enough. I'll try your suggestion of changing the title and printing the warning message as well.

@robertgarrigos
Copy link
Author

Added the title keeping the warning:

Cursor_and_Confirm_deletion_of_post__test___My_Backdrop_Site_-_Vivaldi

@indigoxela
Copy link
Member

indigoxela commented Oct 25, 2024

Added the title keeping the warning:

Oh yes, better.

Of course, loads and loads of functional tests are failing, as they expect a different string for their checks. 😉
And phpcs also has something to nag - coding standards.

But let's see what people think re this UI change. Personally, I find this is an improvement, but I'm no UX specialist.

@robertgarrigos
Copy link
Author

Fixed coding standards and failing tests

@avpaderno
Copy link
Member

@avpaderno, yes, this is just how those contrib modules handle those tabs. Core's behavior is as you have shown, but again, this PR has nothing to do with how core or contrib modules handle the tabs, even I used them to explain the problem.

The issue is exactly how that contributed module handles tabs. It shows a confirmation form on the already rendered tab; that is why the page title changes.

It would not happen if the confirmation form would be rendered on a different page, which is what Backdrop core does with /node/<node ID>/delete.

With the provided PR, /node/<node ID>/delete is rendered as follows.

screenshot

I prefer how Backdrop renders /node/<node ID>/delete.

6a95e6e5f99efff9d6a531b2be5a65f8

@argiepiano
Copy link

argiepiano commented Oct 25, 2024

The current PR assumes that confirm_form() is always used for deletion purposes (it hard-codes "Confirm deletion" as the title. This is not always the case. Confirm forms ARE used for other purposes.

For example, to confirm rebuilding permissions. Navigate to /admin/reports/status/rebuild and you'll see this erroneous and confusing page 👎🏽 :

Screen Shot 2024-10-25 at 6 43 24 AM

confirm_form has a myriad of other uses in contrib, that are not deletions.

Hard-coding titles in a function that is supposed to be agnostic of context is a "no-no" for me. In that same vein, using an if statement to check if the passed $form is that of a node is very limiting use of code, and also a "no-no" for me.

On the other hand I do agree about the ugliness of the UI before the PR.

@robertgarrigos
Copy link
Author

robertgarrigos commented Oct 25, 2024

good point, @argiepiano, I agree. Let's find a different approach. The simplest solution would be to set a fixed, agnostic of context, title, but very clear about what we are doing:

Confirm_action___My_Backdrop_Site_-_Vivaldi

Confirm_action___My_Backdrop_Site_-_Vivaldi

Confirm_action___My_Backdrop_Site_-_Vivaldi

No need of if statement either. Just two lines of code:

system_module_—_backhub

PR fixed with this approach.

@argiepiano
Copy link

argiepiano commented Oct 25, 2024

OK, this is better, but keep in mind that system messages may be shown in a different spot of the layout (or even as a modal window that disappears after a certain amount of time, as is the case with some themes). So, we can't trust that the warning will always be shown in the "right" spot (below the title and above the button). This may confuse the user.

I feel like a system warning should not be used in this case - AFAIK system warnings are rarely used to prompt the user for some action (i.e. confirm something by clicking a button) - they are informational messages that are the results of an action.

Curious to hear others' feedback.

@robertgarrigos
Copy link
Author

Another good point, @argiepiano, I agree. But I'll fix this ;-)

Confirm_action___My_Backdrop_Site_-_Vivaldi

Confirm_action___My_Backdrop_Site_-_Vivaldi

Confirm_action___My_Backdrop_Site_-_Vivaldi

These are not system messages. Note that there is no cross to close them in the upper right corner. They are form elements with prefix to shows as warning message and will not disappear:

system_module_—_backhub

Just pushed a commit with this fix.

@klonos
Copy link
Member

klonos commented Nov 17, 2024

I like the sentiment here, but would really prefer to have the confirmations thrown by confirm_form() replaced by a confirm_dialog() instead, which pops up a dialog instead of taking the user to another page/path. In other words, I would like us to do #3769 / #3771. That would be an awesome feature for 1.30 I think.

The good thing with such a solution is that users are not "redirected" somewhere else - they are kept within the same context of what they were doing.

@robertgarrigos
Copy link
Author

This sounds a better solution, indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment