Add option to allow placing expanded blocks at the top

Created on 31 January 2025, 2 months ago

Problem/Motivation

If you have a lot of blocks, an active block can be hidden at the bottom, but if it's for example an active facet in a search, you might want to put it into focus, by placing it at the top.

Steps to reproduce

Expand a block at the end of a long column of blocks, and like to give it more focus.

Proposed resolution

Allow floating expanded blocks to the top, maybe by subtracting 100 from their block weight value, if enabled?

It could be an extra option under Collapsiblock settings (/admin/config/user-interface/collapsiblock):

[ ] Place expanded blocks at the top

Remaining tasks

Decide if it's worth adding this feature, and how to do it ...

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

4.0

Component

Code

Created by

🇩🇰Denmark ressa Copenhagen

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

Comments & Activities

  • Issue created by @ressa
  • 🇦🇺Australia darvanen Sydney, Australia

    I think this goes beyond the remit of the module, sorry @ressa.

    There are just so many different ways one might want to alter what happens when elements are clicked.

    I really think you're getting into business-logic territory - i.e. that specific use-case would not be wanted by more than a tiny percentage of user of this module. I recommend you do that as part of your own theme where desired.

    Feel free to continue the discussion despite the status change, or you can ping me on Slack, the #contribute channel is probably suitable.

  • 🇩🇰Denmark ressa Copenhagen

    That's all right, I wasn't sure where to make this request, or if it was a useful addition to Collapsiblock ...

    But I guess it's a matter of doing a block preprocess in the theme, or a custom module, like checking for a variable ("expanded") and then add 100 to the weight, like in What is hook_preprocess_block in Drupal | Drupal 10 Tutorial .

    Thanks for the offer of further discussion, I really appreciate it! (Though I don't use Slack )

    If I make it work, I'll share it in the Collapsiblock documentation :)

  • 🇩🇰Denmark ressa Copenhagen

    I tried to preprocess a block and change the weight, but it looks like the blocks be might generated by the Facets module ... so moving this issue, in case it fits better there.

Production build 0.71.5 2024