diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js
index d7fb3cc0760..8abc8eec695 100644
--- a/addons/web_editor/static/src/js/editor/snippets.editor.js
+++ b/addons/web_editor/static/src/js/editor/snippets.editor.js
@@ -1351,16 +1351,26 @@ var SnippetsMenu = Widget.extend({
$selectorSiblings = $(_.uniq(($selectorSiblings || $()).add($selectorChildren.children()).get()));
}
+ var noDropZonesSelector = '[data-invisible="1"], .o_we_no_overlay, :not(:visible)';
if ($selectorSiblings) {
- $selectorSiblings.not('.oe_drop_zone, .oe_drop_clone').each(function () {
+ $selectorSiblings.not(`.oe_drop_zone, .oe_drop_clone, ${noDropZonesSelector}`).each(function () {
var data;
var $zone = $(this);
+ var $zoneToCheck = $zone;
- if (!$zone.prev('.oe_drop_zone:visible, .oe_drop_clone').length) {
+ while ($zoneToCheck.prev(noDropZonesSelector).length) {
+ $zoneToCheck = $zoneToCheck.prev();
+ }
+ if (!$zoneToCheck.prev('.oe_drop_zone:visible, .oe_drop_clone').length) {
data = setDropZoneDirection($zone, $zone.parent());
self._insertDropzone($('').insertBefore($zone), data.vertical, data.style);
}
- if (!$zone.next('.oe_drop_zone:visible, .oe_drop_clone').length) {
+
+ $zoneToCheck = $zone;
+ while ($zoneToCheck.next(noDropZonesSelector).length) {
+ $zoneToCheck = $zoneToCheck.next();
+ }
+ if (!$zoneToCheck.next('.oe_drop_zone:visible, .oe_drop_clone').length) {
data = setDropZoneDirection($zone, $zone.parent());
self._insertDropzone($('').insertAfter($zone), data.vertical, data.style);
}