Problem

Bootstrap Div provides useful visual controls for editing container classes and attributes. However, when divs are nested, the controls consistently target the innermost container containing the cursor.

This makes outer layout wrappers difficult to select without switching to Source editing.

For example:

<div class="row">
  <div class="col-md-4">
    <div class="card">
      <div class="card-body">
        <p>Example content</p>
      </div>
    </div>
  </div>
</div>

When clicking inside the paragraph, the controls target card-body. There is no apparent way to move the editing target outward to card, col-md-4, or row.

Steps to reproduce

Enable Bootstrap Div in a CKEditor 5 text format.

Create nested div containers, such as the example above.

Place the cursor inside the innermost container.

Open the Div editing controls.

Try to select and edit an outer container.

Current behavior

The editing controls target the nearest enclosing div. Selecting outer wrappers is difficult, particularly when their children occupy most of the available area.

In the installed source, _getCurrentDivElement() uses findAncestorDiv() to resolve the nearest ancestor.

Proposed behavior

Provide an explicit way to choose an ancestor container while preserving the current nearest-container default.

Possible approaches:

A Select parent container control.

A clickable ancestor list, such as row → col-md-4 → card → card-body.

Highlight the selected container’s boundaries and show its classes so editors can confirm the target before changing it.

The selected target should remain consistent across class and attribute editing. Keyboard access would also be valuable.

Use case

Editing Bootstrap layouts directly in CKEditor, including rows, columns, cards and callouts, without repeatedly switching to Source editing.

Thank you - the existing Div controls are already helpful. Parent-container selection would make them substantially more practical for nested layouts.

Comments

andres.torres created an issue.

lazzyvn’s picture

if your use bootstrap 5 admin theme you can add pading 2px in your css theme you can see border parent and you can click to border

andres.torres’s picture

Thanks @lazzyvn for the suggestion. We use Gin for administration and Radix/Bootstrap for the frontend. This is a common separation, so selecting nested containers should ideally work independently of the admin theme.

If additional padding is needed to expose selectable parent boundaries, could the module provide that styling within the CKEditor editing area? It should not require changing frontend content spacing or switching admin themes.

Padding may help mouse selection, but an explicit “Select parent container” control or ancestor selector would still provide a more reliable approach for deeply nested layouts and keyboard users.