@@ -24,6 +24,7 @@ import type { DiscussionListParams } from '../states/DiscussionListState';
2424export interface IDiscussionListItemAttrs extends ComponentAttrs {
2525 discussion : Discussion ;
2626 params : DiscussionListParams ;
27+ slidable ?: boolean ;
2728}
2829
2930/**
@@ -57,7 +58,7 @@ export default class DiscussionListItem<CustomAttrs extends IDiscussionListItemA
5758 className : classList ( 'DiscussionListItem' , {
5859 active : this . active ( ) ,
5960 'DiscussionListItem--hidden' : this . attrs . discussion . isHidden ( ) ,
60- Slidable : 'ontouchstart' in window ,
61+ Slidable : this . isSlidableEnabled ( ) ,
6162 } ) ,
6263 } ;
6364 }
@@ -198,13 +199,21 @@ export default class DiscussionListItem<CustomAttrs extends IDiscussionListItemA
198199 return jumpTo ;
199200 }
200201
202+ protected isSlidableEnabled ( ) : boolean {
203+ if ( this . attrs . slidable === false ) {
204+ return false ;
205+ }
206+
207+ return 'ontouchstart' in window ;
208+ }
209+
201210 oncreate ( vnode : Mithril . VnodeDOM < CustomAttrs , this> ) {
202211 super . oncreate ( vnode ) ;
203212
204213 // If we're on a touch device, set up the discussion row to be slidable.
205214 // This allows the user to drag the row to either side of the screen to
206215 // reveal controls.
207- if ( 'ontouchstart' in window ) {
216+ if ( this . isSlidableEnabled ( ) ) {
208217 const slidableInstance = slidable ( this . element ) ;
209218
210219 this . $ ( '.DiscussionListItem-controls' ) . on ( 'hidden.bs.dropdown' , ( ) => slidableInstance . reset ( ) ) ;
0 commit comments