Blocks' IDs are altered by the module?

Created on 27 March 2025, 9 days ago

Problem/Motivation

I now have this working since the removal of the unnecessary REST UI module but immediately I see problems in many places that I have tried to sue it because the module actual alters the ID of blocks to which it is applied (rather than add a utility class for example).

This presents a real problem because the theming (both CSS and JS) of many of our standard blocks is governed by the original IDs.

For example, The Better Social Sharing Buttons block is changed..

<div id="block-bit-by-bit-bettersocialsharingbuttons" class="...">

to...

<div id="block-bit-by-bit-bettersocialsharingbuttons--Z_drOMjRgu8" class="...">

Now, one can always argue that we should avoid targeting IDs in CSS but sometimes you just have to to single a particular block - that's just Drupal markup in real life.

Could you not use some kind of additional 'utility' class such as 'ajax-big-pipe_--Z_drOMjRgu8' instead - that way, you will never run into interfering with any existing theming?

Thank you!

πŸ› Bug report
Status

Active

Version

1.0

Component

User interface

Created by

πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

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

Comments & Activities

  • Issue created by @SirClickALot
  • πŸ‡ΊπŸ‡¦Ukraine Helena Zajika

    The kernel itself forms the id of the block, and since it is rendered separately from the page, the kernel adds a dynamic part to it to avoid duplication. We do not change the id and class independently with the module.

Production build 0.71.5 2024