Drupal Content Blocks are difficult to work with in the sidebar

Created on 25 October 2024, 5 months ago

Problem/Motivation

In Add/manage non-reusable content blocks (Drupal blocks) Fixed support for adding Drupal content blocks has added. This is a really nice addition, but the usability of managing a lot of fields, or CKEditor fields in the small sidebar, is not that user friendly.

Let's explore ways to modify Drupal content blocks in a more user-friendly way. Either in a modal, like Drupal block plugins. Or kind of inline within the Gutenberg editor.

One challenge for an inline embed into the Gutenberg editor would be, that the Frontend Theme is applied there and might lead to odd results.

Example using a modal:

Example using an inline embedding

Steps to reproduce

Proposed resolution

Remaining tasks

  • When using the inline method: Check how the styling behaves with different frontend themes

User interface changes

Content blocks will not be configured in the sidebar anymore, but at a more usable place.

API changes

Data model changes

Feature request
Status

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany szeidler Berlin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @szeidler
  • First commit to issue fork.
  • 🇩🇪Germany szeidler Berlin

    Wow @marcofernandes. This works pretty good for me and the use-case I described in the issue.

    Really nice work and in my opinion works much smoother than editing block content in the sidebar.

  • Pipeline finished with Success
    4 months ago
    Total: 340s
    #325940
  • Pipeline finished with Success
    4 months ago
    Total: 694s
    #344945
  • Pipeline finished with Canceled
    3 months ago
    #360396
  • Pipeline finished with Success
    3 months ago
    Total: 2241s
    #360425
  • Pipeline finished with Skipped
    3 months ago
    #360529
  • Pipeline finished with Success
    about 1 month ago
    Total: 212s
    #415016
  • Pipeline finished with Success
    about 1 month ago
    Total: 234s
    #415034
  • Status changed to Needs review about 1 month ago
  • 🇳🇴Norway vegardjo

    Thanks for this, guys, came at a very convenient time :)

    I've applied this as a patch, and will test it the coming days.

    One remark on the UX here, that I experienced both with the initial sidebar editing and the inline editing (even when being fully aware of it), is that you need to click "update block" before you click "save" on the content form. If you edit the block, and just click save, you will immediately lose the content you have added to the block.

    Even as this makes full sense, people will click save without updating the block, which will lead to frustrations.

    I can see some ways of mitigating it:

    • actually using the modal, even though I also like the inline more, as this prevents you to do this mistake, and also conceptually clarifies better that this is not a normal Gutenberg block.
    • disable the save button if you have changes in the block.
    • give a warning if same as above, similar to when you navigate away without saving.

    Seems to me the most straight forward way to do this is to revert to the modal solution, which I guess would also remove the possible styling issue with the inline method.

  • 🇩🇪Germany szeidler Berlin

    There is of course the decision to do if modal or not.

    One possibility without a modal would be to put Gutenberg into a "non clean state" when having the block expanded. Then the "Save" node button actually would trigger a warning and prevent saving.

  • 🇳🇴Norway vegardjo

    For sure, no objections on that, as long as we can handle the issue one way or the other.

  • 🇳🇴Norway vegardjo

    Just realized that simply clicking outside the block without clicking the update block will also make you lose content.

  • 🇩🇪Germany szeidler Berlin

    Oh wow, I haven't noticed this one so far.

    That's for sure a big UX problem and prone to lose content changes.

  • 🇺🇸United States loze Los Angeles

    Its worth mentioning that the issue described in #8 happens w/o this patch as well. If the block is in the sidebar.

    There should be some way to block clicking on another item, or to autosave the the block if they do.

  • 🇳🇴Norway vegardjo

    Thanks for pointing that out, loze!

    Rounding back to modal, I guess using that approach will mitigate both, as the modal needs to either be x-ed out in the top right, ESC-ed out with keyboard, or saved. It will not close if you click outside, and you are not allowed to save the node unless the modal is closed.

    The visible editing area is also approximately the same, so I'd say the UX is very similar, even though one might prefer one over the other.

  • 🇺🇸United States loze Los Angeles

    Yea, I think a modal is a better approach.

  • 🇳🇴Norway vegardjo

    vegardjo changed the visibility of the branch 3.0.x to hidden.

  • 🇳🇴Norway vegardjo

    vegardjo changed the visibility of the branch 3.0.x to active.

  • 🇮🇳India piyusha_pokharana

    I have altered code in Gutenberg module to show sidebar config in modal popup, but post this changes there were some issues when we have other modal popup on same page like media browser in ckeditor, Media upload option, any other config which gets open in modal.
    The #drupal-modal is actually getting replaced with new config form. Considering this is necessary when implementing the modal approach for sidebar configuration.

  • 🇺🇸United States loze Los Angeles

    @piyusha That is a core bug thats being worked on here 🐛 Nested modals don't work: opening a modal from a modal closes the original Needs work It's not specific to gutenberg

Production build 0.71.5 2024