Skip to content

Commit 303aa42

Browse files
committed
Keep the FLD library HUD visible after an element is selected
Resolves #16521 [ci skip]
1 parent 34c7f7e commit 303aa42

File tree

7 files changed

+14
-20
lines changed

7 files changed

+14
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- The field layout element library HUD is no longer closed automatically when an element is selected. ([#16521](https://github.com/craftcms/cms/discussions/16521))
56
- Added `craft\web\User::getDefaultReturnUrl()`.
67
- Fixed a bug where Entries fields’ entry select modals could show expand/collapse toggles for Structure sections, for elements that didn’t have any selectable descendants. ([#16506](https://github.com/craftcms/cms/issues/16506))
78
- Fixed a bug where changes to custom fields within nested Matrix entries weren’t getting merged into existing drafts for the same owner element. ([#16519](https://github.com/craftcms/cms/issues/16519))

src/web/assets/cp/dist/cp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/cp/dist/cp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/cp/src/js/FieldLayoutDesigner.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ Craft.FieldLayoutDesigner = Garnish.Base.extend(
322322

323323
this.addListener($elements, 'activate', (ev) => {
324324
ev.stopPropagation();
325+
ev.originalEvent.preventDefault();
325326
this.addLibraryElementToActiveTab(ev.currentTarget);
326327
});
327328
},
@@ -368,10 +369,6 @@ Craft.FieldLayoutDesigner = Garnish.Base.extend(
368369
const element = tab.initElement($element);
369370
element.updatePositionInConfig();
370371
this.tabGrid.refreshCols(true);
371-
372-
Garnish.requestAnimationFrame(() => {
373-
hud.hide();
374-
});
375372
},
376373
},
377374
{
@@ -486,7 +483,6 @@ Craft.FieldLayoutDesigner.Tab = Garnish.Base.extend({
486483
this.designer.$fieldLibrary.scrollTop(0);
487484
});
488485
hud.on('hide', () => {
489-
this.designer.$libraryContainer.appendTo(this.designer.$innerContainer);
490486
this.$addBtn.focus();
491487
});
492488

@@ -1712,15 +1708,6 @@ Craft.FieldLayoutDesigner.ElementDrag =
17121708
}
17131709

17141710
this.setMidpoints();
1715-
1716-
// If we're dragging an element from the library, and it's within an HUD,
1717-
// hide the HUD
1718-
if (this.draggingLibraryElement) {
1719-
const $hud = this.$draggee.closest('.fld-library-hud');
1720-
if ($hud.length) {
1721-
$hud.data('hud').hide();
1722-
}
1723-
}
17241711
},
17251712

17261713
/**

src/web/assets/garnish/dist/garnish.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/garnish/dist/garnish.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/garnish/src/Garnish.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,10 @@ $.extend($.event.special, {
10721072
}
10731073

10741074
if (!disabled) {
1075-
$elem.trigger('activate');
1075+
$elem.trigger({
1076+
type: 'activate',
1077+
originalEvent: e,
1078+
});
10761079
}
10771080
},
10781081
'keydown.garnish-activate': function (e) {
@@ -1092,7 +1095,10 @@ $.extend($.event.special, {
10921095
}
10931096

10941097
if (!$elem.hasClass('disabled')) {
1095-
$elem.trigger('activate');
1098+
$elem.trigger({
1099+
type: 'activate',
1100+
originalEvent: e,
1101+
});
10961102
}
10971103
},
10981104
});

0 commit comments

Comments
 (0)