NO BUG: "Add element ID as needed" feature - ID working even when not showing in DOM

I’ve got the “Add element ID as needed” feature switched on in Bricks settings.

I’ve got 2 buttons created, in DOM it just shows the standard CSS class for bricks button, correct.

Although the ID doesn’t show up in DOM, I can still see it in the Bricks editor, for example: ‘brxe-youml’ (as on the screenshot). I can copy the ID.

I’ve created a PHP conditional logic snippet and used this ID, as well as the second ID for the other button in the snippet. It works, and both button elements are showing as per specified conditions.

But even after the ID has been used in the PHP snippet, the DOM hasn’t changed and the ID of the button element is still not showing up in DOM.

So, should the ID be coming up in DOM after it has been used?, or should the ID be functioning even if it’s not technically showing up in DOM?

Hi @Bloggs,

When you enable “Add element ID as needed”, the Bricks will remove all IDs from elements, if there is no styling applied to it. Now, Bricks can not know that you used that specific CSS ID in PHP script.

You have two options:

  1. Add a styling to the ID level (even just one style is enough)
  2. (Better one), inside the Style tab → CSS, yu have “CSS ID” field, where you can enter desired ID, and it will be rendered on the page, even if there are no styling.

Saying that, I’ll mark this topic as a no-bug, because that’s how it works.

Matej

No worries, that makes sense, thanks @Matej

1 Like