fix: #3625311 Do not initialise the hero slider inside the Canvas editor preview

The Hero Slider pattern inserts in the Canvas editor but cannot be published: the Review, Select All, Publish flow never becomes usable. The other seven default patterns publish fine.

hero-slider-container.js had no editor guard, unlike sticky-header.js, icon-toggle.js and offcanvas-menu.js. Its flattenCarouselItems() re-parents .carousel-item nodes with appendChild, and its own comment explains why: Canvas wraps nested components in extra DOM. Those wrappers are how the editor maps preview DOM back to the component tree, so moving the nodes out of them leaves publish with nothing to reconcile.

This adds the same is-canvas-preview detection, so the setup is skipped in the editor only. The front end is untouched.

Verified on a fresh install with the fix deployed: the preview document carries is-canvas-preview, and insert, Review, Select All and Publish all complete. Reproduced the exact CI steps from the 09-drupal-canvas-d lane.

This is what keeps rightup !49 red: five consecutive failures there, and the same lane needed retries on other recent pipelines.

Closes #3625311.

Checkpoints

  • Addition/Change/Update/Fix to this project
  • Testing to ensure no regression
  • Reviewed by a human
  • Code review by maintainers
  • Release

AI-Generated: Yes

Edited by Rajab Natshah

Merge request reports

Loading
Loading