Custom Fields
Re-Envisioned
Support MB Blocks Block doesn’t receive unique ID when duplicated

  • Creator
    Topic
  • #20476
    Resolved badabingbreda
    Participant

    Can you please confirm that a block doesn’t receive its own unique ID whenever you duplicate it using Gutenberg?

    I was trying to use inline CSS on the block, using the attributes[‘id’] as a unique identifier and noticed that when I duplicate that both blocks get the styling from the last block, since this is last and overwrites all the style-settings.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #20485
    Long Nguyen
    Moderator

    Hi,

    Each block has its own unique ID, please see my screen record https://www.loom.com/share/f0076202d7a449308559efd842aa3f35. I’ve printed it out in the preview block.

    #20489
    badabingbreda
    Participant

    Yes, I know that works. What I meant was that when you DUPLICATE an existing block it doesn’t get a unique id.

    In case you would have settings that generate some inline-css that style the block. You would need the block id to target it. The whole idea behind ids is that they should be unique.

    #20491
    Long Nguyen
    Moderator

    Hi,

    Thank you for pointing this out. I’m going to pass this topic to the developer team to check it out. At this time, please try to Add New block to get a different ID.

    #20658
    Long Nguyen
    Moderator

    Hi Didou,

    Please update the new version of MB Blocks v1.2.1 or MB AIO v1.11.14 to get the unique ID of the block when duplicating. And please notice that the ID of the block changes every time updating the post or refresh the editing page, be careful if you use the ID to style the element.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.