Skip to content

[Feature] Support new @drupal/once library in Storybooks #299

@ghost

Description

Is your feature request related to a problem? Please describe.
We have a component in our Drupal project which is using the new drupal/once library instead of jQuery/once.

This works fine when added as a dependency in the Drupal theme but we have trouble getting the code to work in the Storybook.

What would be the best solution to include https://www.npmjs.com/package/drupal/once in the Storybooks and be able to use the new JS functions in Storybooks?

Describe the solution you'd like
I would like to be able to include the drupal/once library in the Storybook components and use the JS function for example in accordion.js to make sure the element is triggered only once.

Probably something like the usual Drupal.behaviors might work but there is of course the NPM package for drupal/once available so it could even be a more robust solution to support the functionality in the storybook js file.

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions