Problem/Motivation

While discussing #2035079: [PP-1] Figure out what to do with the install/uninstall modules page at #3373236: Drupal Usability Meeting 2023-07-14 we identified several issues with disabled checkboxes on the uninstall modules page:

  1. Disable form elements are not recommended from an accessibility or usability perspective, we should avoid using them.
  2. If the user wants to uninstall a module, along with all of the modules which depend on that module, it is currently not possible to do this in a single action. The user must first identify the modules that depend on that module, uninstall those, then they can finally uninstall the original module. This gets quite tedious when you have multiple levels of dependencies.
  3. The uninstall module experience does not provide feature parity with the install module experience. The install modules list allows the user to select any module which is currently not installed (assuming no dependencies are physically missing), and if that module has dependencies, Drupal will automatically install those, and inform the user of this on the confirm form.

Steps to reproduce

Proposed resolution

Allowing users to select even modules which other installed modules depend on would solve the usability and accessibility issues with disabled checkboxes. After the user selects one or more of these modules, the confirm form would then provide a list of modules which will also be uninstalled should the user choose to proceed.

For example, if the user selects the Migrate module, the confirm form would list the Migrate UI module as a module which would also be uninstalled (assuming the user had Migrate UI installed).

We want to draw the user's attention to this, so styling this information as a warning message, and using a bulleted list, would help to ensure that the user is aware that other modules will also be uninstalled.

This also provides parity with the install confirm form, the install module form shows not only the modules the user selected but also any modules that the selected modules depend on.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

AaronMcHale created an issue. See original summary.

vbouchet’s picture

I think the proposed solution / approach only describes the easy path: dependent modules can be uninstalled. But there are situations where a dependent module can't be uninstall because it is used by entities (whatever it is config entity or content entity).

As a first step, we should probably authorise uninstall of modules which all dependent modules are uninstallable as well.

Please find a patch to initiate that work. I have not updated the tests on purpose as I do expect discussion.

I used the form states api to check dependent modules when a module is checked for uninstall.

_utsavsharma’s picture

StatusFileSize
new946 bytes
new3.07 KB

Fixed CCF for #2.

_utsavsharma’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Test failures.

Also believe will need test coverage.

nicxvan’s picture

Component: system.module » extension system
afagioli’s picture

"This gets quite tedious"
Not sure "tediousness" can be an issue.

Multi-step uninstall is pretty common to me. I find this process useful instead to better understand how that Drupal instance is made of.

Following though..

nicxvan’s picture

Status: Needs work » Postponed (maintainer needs more info)

Postponing this only because uninstall can be destructive. I think manually checking the dependency tree is important.

Imagine we add this then someone uninstalled system, suddenly their site is just gone.

I think I would need a very convincing argument that the convenience of single step uninstall is outweighs the risks of accidentally uninstall to many modules.

nicxvan’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)
Related issues: +#468208: Allow uninstalling modules with dependents by offering to recursively uninstall their dependents as well.

Closing this as a duplicate of the related issue.