File tree Expand file tree Collapse file tree
decidim-forms/app/packs/src/decidim/forms Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,10 +35,31 @@ $(() => {
3535 }
3636 } ) ;
3737
38- document . querySelectorAll ( ".js-sortable-check-box-collection" ) . forEach ( ( el ) => new DragonDrop ( el , {
39- handle : false ,
40- item : ".js-collection-input"
41- } ) ) ;
38+ document . querySelectorAll ( ".js-sortable-check-box-collection" ) . forEach ( ( el ) => {
39+
40+ /**
41+ * Due to a bug reported in https://github.com/decidim/decidim/issues/15191
42+ * we have to listen to the `drag` event and prevent the scrolling
43+ * and enabling it back again after it.
44+ */
45+
46+ let preventScroll = function ( event ) {
47+ event . preventDefault ( ) ;
48+ }
49+
50+ el . addEventListener ( "touchmove" , ( event ) => {
51+ preventScroll ( event ) ;
52+ } , { passive : false } ) ;
53+
54+ el . addEventListener ( "touchend" , ( ) => {
55+ el . removeEventListener ( "touchmove" , preventScroll )
56+ } ) ;
57+
58+ return new DragonDrop ( el , {
59+ handle : false ,
60+ item : ".js-collection-input"
61+ } ) ;
62+ } ) ;
4263
4364 $ ( ".answer-questionnaire .question[data-conditioned='true']" ) . each ( ( idx , el ) => {
4465 createDisplayConditions ( {
You can’t perform that action at this time.
0 commit comments