[meta] Improve the "Expose all fields as blocks to Layout Builder" feature

Created on 17 March 2024, 8 months ago
Updated 19 July 2024, 4 months ago

Problem/Motivation

We've reviewed πŸ› Reduce the number of field blocks created for entities (possibly to zero) Fixed at πŸ“Œ Drupal Usability Meeting 2024-03-15 Active . The meeting issue will have a link to a recording soon. For the record, the attendees at the usability meeting were @AaronMcHale, @blackbamboo, @rkoller, @simohell, @SKAUGHT, and @worldlinemine.

The functionality committed in πŸ› Reduce the number of field blocks created for entities (possibly to zero) Fixed will be available for the first time with Drupal 10.3.0. Existing sites upgrading to 10.3.0 will default to the checkbox ticked, thus sticking to the current pre-10.3.0 behavior, which has significant performance implications as soon as a certain number of field block plugins is reached. New installations will default to the checkbox unticked instead.

In our discussion we've identified three areas that might pose potential problems to the user:

Discoverability

The new configuration page can be found at /admin/config/content/layout-builder which is under Configuration -> Content authoring -> Layout Builder. Aside that page there is no indication or notice anywhere else within the Drupal admin ui. Therefore the odds are rather high that this functionality might go unnoticed, since not everyone is reading the changelog closely.
We've also asked ourselves if Content authoring in general is the right place to sort this page under. On one hand that feature influences the amount of field blocks exposed available to the site builder, but on the other hand that setting is not only a measure to hone the selection in the content authoring but also more of a way to improve the overall performance.

Troubleshooting

Closely related to the area of discoverability is the aspect of troubleshooting. There are currently no clues for someone, in-house or external, trying to debug the root cause of a problem unknowingly related to this configuration. The person troubleshooting has to know that this configuration page exists and also understand the underlaying concepts and their consequences.

Comprehension

The main and direct way learning about the functionality and it's underlaying concepts is the label and description on /admin/config/content/layout-builder. @quiteone already raised a concern in #3043330-113: Reduce the number of field blocks created for entities (possibly to zero) β†’ about the description being confusing. That sentiment was shared by one attendee during the meeting. He explained when first reading the label and description he had a hard time understanding the setting and its implications. After following along the demo and going through all the potential cases only then he slowly started wrap his head around everything.

The checkbox component only has the label and the corresponding description available to communicate all the necessary information; thus, the cognitive load is rather high to grasp the implications of the setting made on this configuration page. First the label explains what should be enabled, exposing all fields as blocks to Layout builder. A user might even assume the unticked state means no fields are exposed at all just reading the label and ignoring the description. In the first sentence of the description it then is explained more in detail what actually happens when the checkbox is ticked, all fields for all entity view displays are exposed. In the second sentence it is explained what are the effects when the checkbox is unticked, so that only entity type bundles that have layout builder enabled having their fields exposed. In the third and last sentence it is warned about the significant decrease in performance with a large number of entity types and bundles with the checkbox ticked. Depending on the situation a person always has to jump in-between the pieces of information aka the different lines to piece together the necessary information to figure things out in the current context. The checkbox component has its downside for cases like this where each of the states need some explanation as well as the concept in general.

In addition the terms used, like entity type and in particular bundle, might induce linguistic insecurity. People might be insecure about their meaning, those are challenging terms and concepts and in particular the term bundle isn't used that regularly within the admin ui.

In addition to that the description is missing a few important details so the user might not necessarily be clear about all the consequences. First the detail mentioned in: https://www.drupal.org/node/3416592 β†’

While it is recommended to turn this off, please note that this may remove blocks that are already being used in existing site configurations.For example, if you have Layout Builder enabled on a Node bundle (Content type), and that bundle's display is using field blocks for the User entity (e.g the Author's name), but Layout Builder is not enabled for the User bundle, then that field block would no longer exist after disabling this setting.

is not communicated on the configuration page, so the user might be unaware of that fact and the consequences of removed blocks be unexpected. Second in cases the layout for example for a node bundle (for example article content type) is edited, no fields of any other node bundle (for example basic page content type) are exposed no matter if the checkbox is ticked or not?

Steps to reproduce

Proposed resolution

In the following a few steps that might be taken to improve the problems identified in the Problem/Motivation section:

  1. To improve discoverability there was a clear consensus across the group to recommend adding a new entry to the status reports page about this configuration. Which state is set, and in case the feature is enabled and a certain number of field block plugins is reached and those might become a performance hog for the site move the status report entry to the warnings section (in case the number of field block plugins could be assessed fast and easy).
  2. In the context of discoverability there was also the idea to add an information next to each Use Layout Builder setting pointing to /admin/config/content/layout-builder. But that was just an idea and suggestion no strong recommendation. That addition might be probably a too redundant and induce an information overload across entities. The recommended addition to the status reports page might be already enough.
  3. To add a clue for people troubleshooting there was the suggestion to add a log message when the setting on this configuration page is changed. That way someone debugging can check the log file for a change in that regard.
  4. To improve the comprehension of the configuration page in general there was the clear consensus to recommend changing the ui component from a checkbox to radio buttons, a pattern we've recommended on a few issues over the last few months. In cases like this it is the way more clear interface pattern. The label is setting the overall context of the configuration page. The two radio button option labels explain what each option is actually setting/doing. The description underneath can explain the performance implications as well as the missing details listed in the problem/motivation section. And in general there was the consensus improve the microcopy on the configuration page. But that step can only be taken after there is a clear agreement about the other points in the proposed resolution section.
  5. Another idea and suggestion that was raised is adding a confirmation step when saving the configuration page. To make sure that the user making the change is fully aware about the implications. That confirmation step would mitigate the case illustrated with the blockquote from the linked change record in the problem/motivation section. @simohell had the idea in one of the followup discussions in the #ux channel on Slack to also add the fields and/or layouts to that confirmation step. That way user would be more in control and aware which fields and layouts are affected by such a setting change.

Remaining tasks

The idea making this issue a meta issue was as soon as there is a consensus on this issue about one or more steps in the proposed resolution section create child issues for each of those.

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
Layout builderΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡©πŸ‡ͺGermany rkoller NΓΌrnberg, Germany

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

  • Issue created by @rkoller
  • πŸ‡©πŸ‡ͺGermany rkoller NΓΌrnberg, Germany
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    First of all, thank you for the excellent write up @rkoller and thanks to the UX team for evaluating this so thoroughly.

    This sparked an idea which is basically the opposite of all of this, hindsight is 20/20 after all πŸ˜…

    I think this should have been a feature flag, not configuration (see ✨ Add an API for feature flags Active )

    We used configuration out of convenience, which turned into requiring a config form, upgrade path, config form tests and upgrade path tests. I don't think any of this was particularly necessary. The behavior when the checkbox is checked is undesirable, we simply added all those layers to keep BC and allow people to switch. However, if we continue with this then how do we eventually deprecate that functionality? It seems very challenging.

    Instead, we could/should swap this configuration flag for a feature flag and ditch the settings form entirely. We would need to work out the ins and outs of how feature flag modules (this seems to be the consensus of how the feature flag API should work) are deprecated and communicated first, but I think that is a better path to go down than making this "Expose all fields as blocks to Layout Builder" setting more user friendly.

  • πŸ‡©πŸ‡ͺGermany rkoller NΓΌrnberg, Germany

    that is an interesting idea @acbramley! i would have two questions in regards of the feature flag api.

    • what is the estimated timeline for getting that api into core? it doesn't look it would be ready for 10.3.0 and with πŸ› Reduce the number of field blocks created for entities (possibly to zero) Fixed already in core the problems outlined in issue summary for this issue would still apply to users for the time being until feature flags get in?
    • and how would the feature flag work in the context of this feature? sites pre 10.3.0 would behave like the checkbox is ticked while sites after 10.3.0 would behave like the checkbox is unticked? if that assumption is correct, the only problem is see is the transition and upgrade from 10.2.x to 10.3.x. Currently you have the configuration page that sticks to the ticked state after the upgrade and the user/admin has to manually untick and switch the behavior. with a feature flag in place that option wouldn't (?) be available and the behavior would change with the upgrade to 10.3.0? isn't then there the danger of blocks being removed from layouts automatically as outlined in the change record?
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    @rkoller great questions.

    what is the estimated timeline for getting that api into core?

    The good thing about the solution design is that there's nothing we really need to do for the API - it already exists (modules). So mainly we just need to confirm how these things should be formatted. I.e how the module name should be constructed, and how we convey the information about the feature flag - e.g should we use a module description, hook help, or something else.

    and how would the feature flag work in the context of this feature?

    It would essentially replace the config check with a moduleExists check. All the current behaviours of upgrades vs new sites would be the same. Instead of setting the config in the upgrade path, we'd enable the module. New sites wouldn't have the module enabled by default so they would default to the new behaviour, etc.

  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

    Using a feature flag module is definitely an interesting way of doing this.

    When I think feature flags though, I'm thinking things which are experimental and might be merged in some day, because that's how web browsers like Chromium treat them, I think that'll mean a lot of people will already have that expectation. What we have here though doesn't quite fit that expectation, where we've added this option not as something which might one day be "on by default" but almost the opposite, to remove something which was causing problems.

    Maybe before going ahead with this being a feature flag we should wait to see what we determine their purpose to be?

  • πŸ‡©πŸ‡ͺGermany rkoller NΓΌrnberg, Germany

    thank you @acabremley!

    The good thing about the solution design is that there's nothing we really need to do for the API - it already exists (modules). So mainly we just need to confirm how these things should be formatted. I.e how the module name should be constructed, and how we convey the information about the feature flag - e.g should we use a module description, hook help, or something else.

    that sounds way less complex and controversial than i've initially thought. i was slightly worried it might become a rather long going issue before an initial approach could get in. awesome!

    It would essentially replace the config check with a moduleExists check. All the current behaviours of upgrades vs new sites would be the same. Instead of setting the config in the upgrade path, we'd enable the module. New sites wouldn't have the module enabled by default so they would default to the new behaviour, etc.

    so the module would be the "switch" the equivalent to the current "checkbox" . but then the manual step before enabling the module for existing sites upgrading from 10.2 to 10.3 would still be necessary to make sure that it doesn't comes to an unintended removal of blocks in layout builder like in the example from the issue summary: "For example, if you have Layout Builder enabled on a Node bundle (Content type), and that bundle's display is using field blocks for the User entity (e.g the Author's name), but Layout Builder is not enabled for the User bundle, then that field block would no longer exist after disabling this setting." . but the danger for that case happening would be still imminent isnt it? so it might be necessary and an idea that those "feature flag" modules come along with a confirmation step pointing to potential issues the person installing has to be aware of and has to take care of before proceeding? that information step could be either informational like in the current example (where the preperational step might be too complex) or if possible that confirmation step might contain a configuration option that changes something? so that in some less complex cases the user would be able to alter something in place within the confirmation step preparing the site before going on?

    re #7 and a good point @aaronmchale made. i wonder aside the fact to clearly define what the functionality should exactly do maybe also being mindful not to already use the current suggested name as the working label. i haven't paid close attention to the name yet but the example where feature flags is actually used for activating highly experimental features could be definitely misleading and creating wrong expectations. perhaps it should be considered to find a different name which describes the functionality better. maybe having a bulleted list outlining what the feature actually does might be helpful ideating on a suggestion which might be a better less misleading fit?

  • πŸ‡©πŸ‡ͺGermany rkoller NΓΌrnberg, Germany

    And I've added the feature flags api issue also as a related issue

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    but then the manual step before enabling the module for existing sites upgrading from 10.2 to 10.3 would still be necessary

    No, there will be an automated upgrade path to enable the module for existing sites.

    that those "feature flag" modules come along with a confirmation step pointing to potential issues the person installing has to be aware of and has to take care of before proceeding

    I'm hoping that we can communicate this in the module description and/or help topics

    WRT. what feature flags are/should/can be used for, I think it's very flexible. This would potentially be the first one in core, we can have that discussion in the other issues imo.

  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

    Part of me feels like, if we go down the feature flag route, it still has the same problem that the current checkbox does, in that a on/off checkbox is not really the best way to communicating the two options. So I'm leaning more towards that, whether we have this as a feature flag or not, it may be better to still have a form with the two radio buttons.

  • πŸ‡©πŸ‡ͺGermany rkoller NΓΌrnberg, Germany

    Is the Layout Builder Expose All Field Blocks (Deprecated) module the form feature flag modules will be presented to the users?

    From a functional code perspective it looks like a clean approach. but on the other hand from a usability and end users point of view for one it feels like concepts are mixed here. on /admin/modules you usually have full fledged modules, technically those feature flag modules are in line with that but still they contain a single functionality that is getting discontinued and you are able to switch on and off deliberately. if you have several functions across core getting feature flags then the modules list quickly gets crowded. but the big worry i have is that folks probably won't read the description for the feature flag module nor they will be able to easily distinguish between a module and a feature flag module. And having a description for each state contained in that description makes it sort of lengthy and hard to grasp. by applying a radio button pattern like aaron suggested would mitigate that problem. when you install the feature flag module you get a linkThe Layout Builder Expose All Field Blocks module is deprecated. (more information) on the confirmation step pointing to https://www.drupal.org/node/3223395#s-layout-builder-expose-all-field-bl... β†’ . if you search on that page for "layout" there is no match. The implications and the background about the why is not that clear to the user imho. and i think some of the points in the proposed resolution in this issue still apply at least in part and it might still be worth the thought implementing at least some of them?
    Overall I wonder if it would make sense to add a new local task to the extend page and move all available feature flag module over there. To separate regular modules from feature flags? and on the tab for feature flags dont apply the checkbox pattern but instead introduce a new pattern where each of the listed feature flag modules has two radio buttons instead. makes the labeling easier more concise and clear?

  • πŸ‡­πŸ‡ΊHungary djg_tram

    I never followed this discussion, so I'm not entirely certain it's related by I have a suspicion it is. After upgrading to 10.3, I accepted the proposition and disabled the module. I was immediately greeted with "Entity view display 'xxx': Component 'yyy' was disabled because its settings depend on removed dependencies." warnings. A terrible excuse of an error message because it doesn't even try to identify the issue but by adding a debug printout, the actual dependencies are from Layout Builder, hence my suspicion. These views don't use Layout Builder, actually. Every single page refresh generates such warnings, so the log is literally inundated with them.

    So, I just followed Google's trail here. There's no `/admin/config/content/layout-builder`at all, is this something that got removed in the meantime?

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    @djg_tram thank you for the message, this was covered in the CR for the original issue that changed this functionality https://www.drupal.org/node/3416592 β†’

    This CR was outdated in that it was still referring to the setting that was originally developed. However, in your case, re-enabling the module will fix your issues once caches are cleared. I have now fixed this.

    If you're still having issues, please open a bug report.

    Thanks!

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    @djg_tram I actually just noticed the same error on a fresh Standard install of Drupal with Layout builder disabled. This warning is not related to this issue.

  • πŸ‡¬πŸ‡§United Kingdom mustanggb Coventry, United Kingdom

    Seeing as πŸ› Reduce the number of field blocks created for entities (possibly to zero) Fixed has been closed, I'll ask here.

    How are you meant to know if you can turn this module(/feature flag) off?

    Is there a way to list all instances of field blocks being used where their layout builder option hasn't been enabled?

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    We should implement #16 in code as a status report message if the module is enabled but can safely be disabled.

  • I agree. I was worried about disabling the module, wondering if I would unknowingly break something.

    I ended up disabling it, and then exporting config, to see if anything changed.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    @solideogloria that's a great idea!

    As for knowing whether you can disable it (without the great suggestion in #17) you could check if any of your view_display config that uses layout builder contains either field_block:ENTITY_TYPE_ID or extra_field_block:ENTITY_TYPE_ID blocks, where ENTITY_TYPE_ID is the machine name of an entity type that does NOT use layout builder.

    If there are no field blocks in use, or only field blocks in use which have at least one bundle that uses layout builder, you can safely disable the module.

  • πŸ‡¬πŸ‡§United Kingdom mustanggb Coventry, United Kingdom

    Fantastic replies.

    I did consider #18, but didn't have enough information to know if this was thorough enough.

    I think #19 is what I was originally asking for, so I will do #19, #18, and 🀞.

    But #17 would be the ideal, for both the less technically competent, or (like me) time limited.

Production build 0.71.5 2024