Problem/Motivation

drupalSettings are not available in Storybook because of https://www.drupal.org/project/drupal/issues/2592925.

I'm not clear if this is the right module to fix this in.

Steps to reproduce

Access Storybook when functionality relies on drupalSettings being available.

Proposed resolution

https://www.drupal.org/project/drupal/issues/2592925 prevents drupalSettings getting attached inside of Storybook because the markup is different.

Original

  const settingsElement = document.querySelector(
    'head > script[type="application/json"][data-drupal-selector="drupal-settings-json"], body > script[type="application/json"][data-drupal-selector="drupal-settings-json"]',
  );

Suggested Change

  const settingsElement = document.querySelector(
    'head > script[type="application/json"][data-drupal-selector="drupal-settings-json"], body > script[type="application/json"][data-drupal-selector="drupal-settings-json"], #storybook-root > div > script[type="application/json"][data-drupal-selector="drupal-settings-json"]',
  );

I'm unclear if this opens up any sort of security concerns.

Remaining tasks

Overwriting core's core/drupalSettings library.

Issue fork cl_server-3422691

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joelsteidl created an issue.