Problem/Motivation

Contextual links are useful and can be very productive. But they can also become the very opposite soon. When typing "contextual links" in the contrib module search or in the core issue queue search reading thru all the enabling and disabling issues, you will quickly get the picture of how much Contextual links can cause various biased opinions in the community about when they should show up or not and that they can get easily in the way and can easily cause problems, which cannot be fixed all for one or any possible scenario.

Steps to reproduce

Contextual links can UX-wise feel like It's Hobson's choice (all or nothing) for use cases with complex layouts and can easily run into situations you wish to disable them and accepting the missing features for the positive effect that Contextual links related markup issues or UX issues (mouse hover clutter) fade away. But you can't disable them in all situations. Modules like Layout Builder depend on them.

For example: By extensive use of nested view modes or smaller Blocks in item lists Contextual links can become disturbing a lot. Often 2 or 3 Contextual links groups are overlapping each other and you can't hit the correct one. Or can even disturb positioning HTML elements inline and need a lot of custom work-arounds. Especially when they come up on every nested page element or entity view mode element in that list. Even a media type image teaser view mode nested as field in an article image into an article layout can have 2 or more nested Contextual link groups. And come become more if other Contextual links aware elements are nested into the nested view mode. Try to imagine that on a frontpage teaser list of an online magazine.

Proposed resolution

Enable the user to configure and activate/deactivate contextual links individually and partially in the admin UI for different elements or element groups like entity types or view modes and giving them additional granularity in setting them up for certain paths or contexts like we do it on Blocks.

This would make it possible to disable them for individual media view modes or user roles on frontpage, but leave them enabled for the Node Block in the Full node view mode or node page. Just to mention one example. Or to disable them for all but Layout Builder, like discussed in another issue.

Remaining tasks

  • Consider to discuss in upcoming events regarding Drupal UX.
  • Collect issues which all could be solved by this issue and relate/link them to this one here. (look at right sidebar: related issues)
  • Buildup a road map and plan regarding the Drupal version when this could be realistically added and how.
  • Invite maintainers of other core and contrib modules which depend on Contextual links to join.

User interface changes

  • New config page named "Contextual links" under /config/user-interface/contextual-links.
  • New Contextual links setting forms in admin pages like Blocks and View or Display modes.

API changes

None.

Data model changes

None.

Release notes snippet

Making Contextual links configurable and adding element and context based settings.

Comments

diqidoq created an issue. See original summary.

dqd’s picture

Issue summary: View changes
dqd’s picture

Issue summary: View changes
jbitdrop’s picture

+1!

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

le72’s picture

+1

solideogloria’s picture

There's a toggle button that makes contextual links visible without needing to hover. I think it'd be nice if there was an option to disable showing them on hover. As said in the issue description, sometimes small elements make it really annoying. But since there's an "Edit" button that shows contextual links, I don't think the hover functionality is necessary at all times, and it'd be nice if that could be made into a setting.

dqd’s picture

Issue summary: View changes
larowlan’s picture

Category: Task » Feature request

This sounds like a feature request

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.