From 922cb8bb119de13c1cb6fd3923aabbf015de5376 Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Tue, 29 Sep 2020 00:07:05 +0100 Subject: [PATCH] Fix mobile controls gesture on discussion deletion/restoration (#2324) Because the Slidable class was always added on creation, it was lost every time the class list changed (in this case when the discussion was hidden/unhidden which added/removed DiscussionListItem--hidden class). So by determining the Slidable class's presence in elementAttrs() method, it guarantees it always properly set. --- framework/core/js/src/forum/components/DiscussionListItem.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/core/js/src/forum/components/DiscussionListItem.js b/framework/core/js/src/forum/components/DiscussionListItem.js index 4f2c1a78d..438d503b9 100644 --- a/framework/core/js/src/forum/components/DiscussionListItem.js +++ b/framework/core/js/src/forum/components/DiscussionListItem.js @@ -50,6 +50,7 @@ export default class DiscussionListItem extends Component { 'DiscussionListItem', this.active() ? 'active' : '', this.attrs.discussion.isHidden() ? 'DiscussionListItem--hidden' : '', + 'ontouchstart' in window ? 'Slidable' : '', ]), }; } @@ -136,7 +137,7 @@ export default class DiscussionListItem extends Component { // This allows the user to drag the row to either side of the screen to // reveal controls. if ('ontouchstart' in window) { - const slidableInstance = slidable(this.$().addClass('Slidable')); + const slidableInstance = slidable(this.$()); this.$('.DiscussionListItem-controls').on('hidden.bs.dropdown', () => slidableInstance.reset()); }