Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #1049 [Site] Fix CodeExpander without expandCodeButton target (…
…smnandre) This PR was merged into the 2.x branch. Discussion ---------- [Site] Fix CodeExpander without expandCodeButton target | Q | A | ------------- | --- | Bug fix? | yes | License | MIT The CodeBlock component uses the "code-expander" Stimulus controller, which is responsible to... expand the code. But on the [LazyImage](https://ux.symfony.com/lazy-image) page, the button usually present is replaced by an informational div. | Common usage | LazyImage page | | - | - | | ![with-button](https://github.com/symfony/ux/assets/1359581/b960d8b0-5250-4ac9-b6ac-061f602b4123) | ![without-button](https://github.com/symfony/ux/assets/1359581/7d74b931-7a1b-4185-a879-be8872d0b291) | Hence the following JS error ```console Error connecting controller Error: Missing target element "expandCodeButton" for "code-expander" controller get stimulus.js:2153 connect code-expander-controller-402db0232698738a8988bbaba08c533d.js:1 [...] start stimulus.js:1974 startStimulusApp loader-e1ee9ace0562f2e6a52301e4ccc8627d.js:2 <anonymous> bootstrap-9ce723d68588a7672b3759b7a06e85c3.js:1 Object { identifier: "code-expander", controller: {…}, element: div.terminal-body } stimulus.js:2017:20 ``` I propose to make the code-expander controller work even when the button is not connected, thus allowing to decouple the "expand" action from its origin. Commits ------- 9e7f7c1 Fix CodeExpander without expandCodeButton target
- Loading branch information