A platform for community discussion. Free, open, simple.
FIX: more specific class for topic selected in bulk (#36141)
Joffrey JAFFEUX4986ed6b6854
diff --git a/app/assets/stylesheets/common/base/_topic-list.scss b/app/assets/stylesheets/common/base/_topic-list.scssindex 2f7476a67c2..e6ad14d89c5 100644--- a/app/assets/stylesheets/common/base/_topic-list.scss+++ b/app/assets/stylesheets/common/base/_topic-list.scss@@ -180,7 +180,7 @@cursor: pointer;}- &.selected {+ &.bulk-selected {background: var(--tertiary-low);}}diff --git a/frontend/discourse/app/components/topic-list/item.gjs b/frontend/discourse/app/components/topic-list/item.gjsindex a6eda903043..cb65964df6f 100644--- a/frontend/discourse/app/components/topic-list/item.gjs+++ b/frontend/discourse/app/components/topic-list/item.gjs@@ -117,16 +117,19 @@ export default class Item extends Component {onBulkSelectToggle(e) {e.stopImmediatePropagation();+ const topicNode = e.target.closest(".topic-list-item");+if (e.target.checked) {- this.selectTopic(e.target.closest(".topic-list-item"), e.shiftKey);+ this.selectTopic(topicNode, e.shiftKey);} else {- this.unselectTopic();+ this.unselectTopic(topicNode);}}- unselectTopic() {+ unselectTopic(topicNode) {this.args.selected.removeObject(this.args.topic);this.args.bulkSelectHelper.lastCheckedElementId = null;+ topicNode.classList.remove("bulk-selected");}selectTopic(topicNode, shiftKey) {@@ -149,6 +152,7 @@ export default class Item extends Component {}this.args.bulkSelectHelper.lastCheckedElementId = topicNode.dataset.topicId;+ topicNode.classList.add("bulk-selected");}@action@@ -156,14 +160,12 @@ export default class Item extends Component {if (this.args.bulkSelectEnabled) {event.preventDefault();- const checked = this.args.selected.includes(this.args.topic);- if (checked) {- this.unselectTopic();+ const topicNode = event.target.closest(".topic-list-item");+ const selected = this.args.selected.includes(this.args.topic);+ if (selected) {+ this.unselectTopic(topicNode);} else {- this.selectTopic(- event.target.closest(".topic-list-item"),- event.shiftKey- );+ this.selectTopic(topicNode, event.shiftKey);}return;@@ -284,7 +286,6 @@ export default class Item extends Component {(if @topic.pinned "pinned")(if @topic.closed "closed")(if @bulkSelectEnabled "bulk-selecting")- (if this.isSelected "selected")this.tagClassNamesthis.additionalClasses}}