jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/370965 )

Change subject: DraggableElement: Make toggling draggability consistent
......................................................................


DraggableElement: Make toggling draggability consistent

* Move some setup code from constructor to #toggleDraggable
* Make the constructor call #toggleDraggable

Bug: T172781
Change-Id: I569bb9b5c072c6928a4379cd5ff64b784d775e12
---
M src/mixins/DraggableElement.js
1 file changed, 8 insertions(+), 6 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/src/mixins/DraggableElement.js b/src/mixins/DraggableElement.js
index 9e4b92f..47cda32 100644
--- a/src/mixins/DraggableElement.js
+++ b/src/mixins/DraggableElement.js
@@ -21,14 +21,10 @@
        this.index = null;
        this.$handle = config.$handle || this.$element;
        this.wasHandleUsed = null;
-       this.draggable = config.draggable === undefined ? true : 
!!config.draggable;
 
        // Initialize and events
-       this.$element.addClass( 'oo-ui-draggableElement' )
-               // We make the entire element draggable, not just the handle, 
so that
-               // the whole element appears to move. wasHandleUsed prevents 
drags from
-               // starting outside the handle
-               .attr( 'draggable', true )
+       this.$element
+               .addClass( 'oo-ui-draggableElement' )
                .on( {
                        mousedown: this.onDragMouseDown.bind( this ),
                        dragstart: this.onDragStart.bind( this ),
@@ -37,6 +33,7 @@
                        drop: this.onDrop.bind( this )
                } );
        this.$handle.addClass( 'oo-ui-draggableElement-handle' );
+       this.toggleDraggable( config.draggable === undefined ? true : 
!!config.draggable );
 };
 
 OO.initClass( OO.ui.mixin.DraggableElement );
@@ -85,6 +82,11 @@
                this.draggable = isDraggable;
 
                this.$handle.toggleClass( 'oo-ui-draggableElement-undraggable', 
!this.draggable );
+
+               // We make the entire element draggable, not just the handle, 
so that
+               // the whole element appears to move. wasHandleUsed prevents 
drags from
+               // starting outside the handle
+               this.$element.prop( 'draggable', this.draggable );
        }
 };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/370965
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I569bb9b5c072c6928a4379cd5ff64b784d775e12
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <matma....@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to