Canvas AI: Components should be added to the intended slot
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3552030. -->
Reported by: [akhil babu](https://www.drupal.org/user/3632866)
Related to !231
>>>
<h3 id="overview">Overview</h3>
<p>Currently, it is not possible to place components in a specific slot using Page Builder, following the changes in <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3540211" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3540211</a></span>.</p>
<h3>Testing Steps</h3>
<ul>
<li>Install the canvas_test_sdc module to get the test components.</li>
<li>Try the prompt: <em>'Using Page Builder, add a two-column layout with 3 Drupal icons in the second column'.</em></li>
<li>You might see that the Drupal icons are added in the first column rather than the second column.</li>
</ul>
<p>The agent generates the correct output</p>
<pre>operations:<br> - target: content<br> placement: inside<br> components:<br> - sdc.canvas_test_sdc.two_column:<br> props:<br> width: 25<br> slots:<br> column_two:<br> - sdc.canvas_test_sdc.druplicon: {}<br> - sdc.canvas_test_sdc.druplicon: {}<br> - sdc.canvas_test_sdc.druplicon: {}</pre><p>However, the underlying code does not consider the slot index.</p>
<p>If the issue is not reproducible, the agent’s output may have added an empty value for the column_one slot:</p>
<pre>operations:<br> - target: content<br> placement: inside<br> components:<br> - sdc.canvas_test_sdc.two_column:<br> props:<br> width: 25<br> slots:<br> column_one: [] #If this is present in the agent's response, the issue will not be reproducible.<br> column_two:<br> - sdc.canvas_test_sdc.druplicon: {}<br> - sdc.canvas_test_sdc.druplicon: {}<br> - sdc.canvas_test_sdc.druplicon: {}</pre><p>In such cases try "Using Page Builder, add a two-column layout with 3 Drupal icons in the second column. Exclude column_one slot from response"</p>
<h3 id="proposed-resolution">Proposed resolution</h3>
<h3 id="ui-changes">User interface changes</h3>
issue