Problem/Motivation
During #3304790: Drupal Usability Meeting 2022-08-26, while reviewing an unrelated issue, it was noted that the Delete local task is not always presented as the last local task.
This is most obvious when editing a Node in Umami (which has Layout Builder and Content Translation installed), where the "Delete" tab appears in-between the "Edit" and "Layout" tabs:

With Layout Builder installed, this feels particularly odd; It would be better to have the "Edit" and "Layout" tabs together, with "Delete" appearing after "Revisions" and "Translate".
"Delete" being the last tab makes more sense because it is the only tab which leads the user down an unrecoverable path (permanently deleting the content); Whereas the four other tabs (excluding "View") all involve some form of manipulating the existing piece of content, whether that be: editing a field, changing the layout, reverting to a previous version or translating the content; All of these actions involve making incremental, recoverable changes, so it makes sense that they are grouped together.
While this problem is most obvious on Nodes, the same is present for other core content entities, including Media and Custom Block.
Steps to reproduce
Proposed resolution
This issue was discussed at #3307567: Drupal Usability Meeting 2022-09-09.
The weight of the Delete local task on all core content entities should be increased so that it always appears last. Additional tests could be added to the relevant modules to ensure that in the future Delete always remains the last local task.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3306388-delete-last.png | 38.46 KB | capysara |
Issue fork drupal-3306388
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
aaronmchaleI'll discuss this at #3306259: Drupal Usability Meeting 2022-09-02 or a future usability meeting to hopefully get sign off on the proposed resolution.
Comment #3
aaronmchaleWe reviewed this issue #3307567: Drupal Usability Meeting 2022-09-09, that issue will have a link to the recording.
There were no objections to the proposed resolution, it was positively received. On that basis we should proceed with this issue.
Comment #4
joachim commented> Pending discussion and agreement at a future UX meeting, the proposed resolution could be to increase the weight for the Delete local task on all core content entities so that it always appears last.
Last relative to tabs provided by core, or absolutely last relative to any tab that's added by contrib?
E.g. Devel module adds a tab to entities, and that is shown last, though I don't know if that's by using a big weight or by making it beat all other weights.
Comment #5
aaronmchaleThat's a good question. My intention was only considering tabs that Core adds; We can't cover all possible tabs that contrib might add, but I'd go for a high weight, I had something like 80 or 90 in mind.
In the case of Devel, personally I would actually expect that to be last if the module is installed. Using the same logic in the issue summary for why Edit and Layout should be grouped. If you consider the core tabs - Edit, Layout, Revision, Translate and Delete - all allow manipulating or removing content, whereas Devel is more developer focused, I imagine it's probably not being installing it in the production environment but probably is in the dev and test environments, so you might want it to be "off to the side" so to speak.
Comment #6
benjifisher+1 for putting "Delete" after the other core tabs, but not after "Devel".
All we have to decide now is what weight to use, right?
The Devel module uses
'weight' => 100,: see https://git.drupalcode.org/project/devel/-/blob/4.x/src/Plugin/Derivativ...The Revisions tab sets
weight: 20: seenode.links.task.yml. That is the same file that setsweight: 10for the Delete tab.I vote for 80, one of the suggestions in #5. But I would not object to anything between 50 and 90.
Looking at the Git history, the tabs from the Node module have had the current weights since early in the development of D8: #2102125: Big Local Task Conversion.
At the risk of scope creep, I wonder about the Layout and Translate tabs. From a structural level, it would make sense to put them after the tabs provided by the Node module. But on this issue, we are (so far) agreed to consider usability over structure. I think I like having Layout close to Edit, as it is now. I certainly would not change it without reviewing the issue where it was added. For reference, the weight for the Layout tab is set in
Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::buildLocalTasks().Comment #7
aaronmchaleAs of 10.1 there will be a Revision Local Task which will appear on any content entity which implements the new Generic Revision UI. The weight of the Revision Local Task is
20, I'm assuming to matchnode, so it will currently appear after the Delete Local Task for most (all?) implementing content entities.Comment #11
capysara commentedIs there still interest here?
I went with weight 80 since that has the most votes.
Updated the Delete weight for:
node
block_content
media
taxonomy
comment
workspace (/admin/config/workflow/workspaces/manage/stage/edit)
Updated the Translate weight to 70 so that it wouldn't display last.
I manually tested by enabling media, layout builder, language, translation modules, and workspaces.
Enabled layout builder and translation for entity types.
Added content.
Confirmed that Delete displays last.
Comment #12
smustgrave commentedEven though a task seems like something. that should of had test coverage. Suppose we can add here.
Comment #13
shasha821110 commentedVote +
Delete should be the last one in the tab.