Overview
When a component’s Twig template contains a render error (for example, referencing a property before it is defined), the component appears greyed out in the Canvas component list and cannot be added to the page.
However:
- The component still appears in the “Available component list” on /admin/appearance/components
- There are no clear error messages on the Canvas UI
- There is no indication why the component is disabled
- The “Disabled & incompatible components” tab does not provide actionable information in this scenario
This makes debugging confusing and time-consuming. In my case, the issue was caused by using a property in Twig before defining it in the component schema. It took some investigation to understand why the component was greyed out.
Steps to reproduce
- Create a Canvas component with a valid .component.yml
- Introduce a Twig render error (e.g. reference a prop that is not defined in the schema)
- Clear cache
- Open Canvas and try to add the component
Current behaviour
- Component appears greyed out in the Canvas component list
- No visible error or explanation in the UI
- No hint that the issue originates from a Twig render error
Proposed behaviour
If a component cannot be rendered due to a Twig/render error, Canvas should:
- Display a visible warning or error indicator next to the component name (warning icon is already there btw)
- Provide an explanatory tooltip when hovering the greyed component
- Optionally show a short message like: "Component cannot be rendered due to Twig/render error. Check logs for details" or similar. Ideally expose the actual error message (when in dev mode). Even a minimal hint (e.g. “Render error detected”) would significantly improve the debugging experience.
Comments
Comment #2
spleshkaComment #3
wim leersHi @spleshka — long time no see! 😄
Thanks for creating this issue. However … I cannot reproduce it. We specifically did a lot of work around making sure the DX around all this is good & helpful 😬 See
If I place the test SDC at
tests/modules/canvas_test_sdc/components/simple/headingand hack its Twig to be invalid:I see this:

(Because I'm a developer and hence have verbose error logging turned on. See the screenshots in the issue summary of #3485878: Server-rendered component instances should NEVER result in a user-facing error, should fall back to a meaningful error instead (+ log) — that illustrates what you should see when verbose error logging is turned off.)
Comment #4
spleshkaHi @Wim, indeed nice to see you again in the issue queue 😊.
The issue I had was on the environment with the following component (I've changed the component name for simplicity):
test.component.yml:
And the template:
test.twig:
For some reason, on my local environment for the client project the component is greyed-out and when I hover over it then just nothing happens (tested on latest versions of Canvas - both 1.1.0 and 1.1.1). However, when I tried to reproduce the same issue (now that you mentioned you can not reproduce it) on another environment (drupal cms from scratch using ddev) and when I hover over the same component the tooltip comes up saying that there's a render error and I should check the logs:
I'm a bit confused as to what did we do wrong on the client project so that the tooltip does not appear. We didn't hack Canvas, I promise! 😄
I'll continue the investigation and update the issue when the mistery is solved.
Comment #5
spleshkaAlright, we managed to identify the cause of the issue on our side and wanted to share it here in case it helps others.
The problem turned out to be related to Content Security Policy (CSP) configuration. In our setup we had a fairly strict policy, specifically:
Because of this, the component preview popup in the Canvas sidebar (shown when hovering over components) did not appear. After investigating further, we noticed that Canvas renders the preview inside an iframe generated from a blob: URL. Since our CSP only allowed self, the iframe was being blocked by the browser.
Adding
blob:to the frame-src directive resolved the issue:Once this was added, the preview popups started working correctly.
I wonder is there any recommended CSP configuration for Canvas to ensure that all of its UI features work correctly? If not, it might be useful to convert this issue (or a follow-up) into documentation describing the minimum CSP directives required for Canvas, since many sites using Canvas are likely to run with stricter CSP policies.
Comment #6
bnjmnm@spleshka the blob usage was removed in 1.x ~2 weeks ago in this issue #3575072: Component preview doesn't work for code components in Safari. The reported issue it addressed had slightly different symptoms, but was also related to CSP. It is part of Canvas 1.2.0.
I'm closing as outdated, but by all means reopen if this does not address the problem.
Comment #8
spleshkaThat's great news, thank you @bnjmnm.