Block doesn't receive unique ID when duplicated

Support MB Blocks Block doesn't receive unique ID when duplicatedResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #20476
    badabingbredabadabingbreda
    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.

    #20485
    Long NguyenLong 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
    badabingbredabadabingbreda
    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 NguyenLong 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 NguyenLong 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 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.