WIP: Broken JS in Shortcode in Tabs (Nestable)

Browser: Chrome
OS: macOS
Video: https://imgur.com/a/bricks-bug-1-11-1-1-broken-js-shortcode-tabs-nestable-TJW4XIh

When using a somewhat weird combination of a shortcode with a Tabs (Nestable) element, JavaScript code inside the shortcode breaks.

Preparation

  1. Add this code to your functions.php or anywhere else
add_shortcode("broken_shortcode", function ($args) {
    return "<script>\n" . 
    "    // This script is broken\n" . 
    "    // </div>\n" . 
    "</script>\n";
});
  1. Add this shortcode inside a “Tabs (Nestable) > Shortcode” Bricks-element: [broken_shortcode]

Expected output

<script>
    // This script is broken
    // </div>
</script>

Actual output

<script>
    // This script is broken
    // </script></div>

As you can see, the Closing Script tag moved to the wrong place, breaking the whole page.

Hi @johannesglaser,

yeah, I can replicate this. I’ve added it to the internal bug tracker, and will update this topic once we fix this issue.

For now, you will have to avoid using broken scripts in the nestable tabs. :slight_smile:

Thanks,
Matej

1 Like