diff --git a/ghost/admin/app/components/multi-list/item.js b/ghost/admin/app/components/multi-list/item.js index 0fd414d2f7..c3d2169b99 100644 --- a/ghost/admin/app/components/multi-list/item.js +++ b/ghost/admin/app/components/multi-list/item.js @@ -86,6 +86,7 @@ export default class ItemComponent extends Component { } else { this.selectionList.clearSelection(); this.selectionList.toggleItem(this.id); + this.selectionList.clearOnNextUnfreeze(); this.dropdown.toggleDropdown('context-menu', this, {left: x, top: y, selectionList: this.selectionList}); } diff --git a/ghost/admin/app/utils/selection-list.js b/ghost/admin/app/utils/selection-list.js index 367159f9d1..3dc3f115ba 100644 --- a/ghost/admin/app/utils/selection-list.js +++ b/ghost/admin/app/utils/selection-list.js @@ -12,6 +12,11 @@ export default class SelectionList { #frozen = false; + /** + * When doing right click on an item, we temporarily select it, but want to clear it as soon as we close the context menu. + */ + #clearOnNextUnfreeze = false; + constructor(infinityModel) { this.infinityModel = infinityModel ?? {content: []}; } @@ -22,6 +27,14 @@ export default class SelectionList { unfreeze() { this.#frozen = false; + if (this.#clearOnNextUnfreeze) { + this.clearSelection(); + this.#clearOnNextUnfreeze = false; + } + } + + clearOnNextUnfreeze() { + this.#clearOnNextUnfreeze = true; } /**