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
Comment #2
dqdComment #3
dqdComment #4
jbitdrop commented+1!
Comment #7
le72+1
Comment #8
solideogloria commentedThere'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.
Comment #9
dqdComment #10
larowlanThis sounds like a feature request