diff --git a/reviewboard/static/rb/css/pages/reviews.less b/reviewboard/static/rb/css/pages/reviews.less
index dab489c99a64a1a7c049cae94642959a5587c497..522ec6a7054a0eaa7fe674cf844735caee2302ad 100644
--- a/reviewboard/static/rb/css/pages/reviews.less
+++ b/reviewboard/static/rb/css/pages/reviews.less
@@ -1912,7 +1912,7 @@
   border-radius: @box-border-radius;
   box-shadow: @box-shadow;
   cursor: default;
-  margin-top: 8px;
+  margin-bottom: 8px;
   overflow: hidden;
   position: absolute;
 
diff --git a/reviewboard/static/rb/js/views/commentDialogView.es6.js b/reviewboard/static/rb/js/views/commentDialogView.es6.js
index 6e8968a0bc588bd0bc13ef5676e028cc923446f2..cb589c39ad8013b786fba9dc05dbd390fb7e7a86 100644
--- a/reviewboard/static/rb/js/views/commentDialogView.es6.js
+++ b/reviewboard/static/rb/js/views/commentDialogView.es6.js
@@ -195,7 +195,6 @@ RB.CommentDialogView = Backbone.View.extend({
         'click .buttons .save': 'save',
         'keydown .comment-text-field': '_onTextKeyDown',
     },
-
     /**
      * Initialize the view.
      *
@@ -355,7 +354,7 @@ RB.CommentDialogView = Backbone.View.extend({
         this.listenTo(this.model, 'change:richText', this._handleResize);
 
         this.$el
-            .css('position', 'absolute')
+            .css('position','fixed')
             .mousedown(evt => {
                 /*
                  * Prevent this from reaching the selection area, which will
@@ -372,10 +371,69 @@ RB.CommentDialogView = Backbone.View.extend({
             .proxyTouchEvents();
 
         this._$header.css('cursor', 'move');
+        //Storing the reference to the comment dialog
+        const commentBox = this.$el;
+        commentBox
+            .on('mousedown', () => {
+                const top = commentBox.offset().top;
+                commentBox.css({
+                    'position': 'absolute',
+                    'top': `${top}px`,
+                });
+            })
+            .on('mouseup', () => {
+                const top = commentBox.offset().top - $(window).scrollTop();
+                commentBox.css({
+                'position': 'fixed',
+                'top': `${top}px`,
+                });
+            });
+        /**
+         * Check if the Dialog is inside of the content area
+         * relative to the top of the viewport.
+         *
+         * Returns:
+         *      Boolean:
+         *      A boolean value, true if outside the content area
+         *      or at the top of the document.
+         */
+        function isAbove() {
+            const isOutsideTopContentArea = commentBox.offset().top < $(window).scrollTop();
+            const isTopOfDocument = commentBox.offset().top === 0;
+
+            return isOutsideTopContentArea || isTopOfDocument;
+        }
+        /**
+         * Check if the Dialog is inside of the content area
+         * relative to the bottom of the viewport.
+         *
+         * Returns:
+         *      Boolean:
+         *      A boolean value, true if below the content area.
+         */
+        function isBelow() {
+            const bottomOfViewport = $(window).scrollTop() + $(window).height();
+
+            return commentBox.offset().top > bottomOfViewport;
+        }
         this.$el.draggable({
             handle: '.comment-dlg-header',
+            containment: 'document',
+            stop: function(event, ui) {
+                if(isAbove()) {
+                    commentBox.css({
+                        'position': 'fixed',
+                        'top': `${ui.helper.scrollTop()}px`,
+                    });
+                } else if (isBelow()) {
+                    const bottomOfScreen = ui.helper.scrollTop() + ui.helper.height();
+                    commentBox.css({
+                        'position': 'fixed',
+                        'top': `${bottomOfScreen}px`,
+                    });
+                }
+            },
         });
-
         this.listenTo(this.model, 'change:dirty', this._updateTitle);
         this._updateTitle();
 
@@ -398,7 +456,6 @@ RB.CommentDialogView = Backbone.View.extend({
 
         return this;
     },
-
     /**
      * Callback for when the Save button is pressed.
      *
@@ -424,7 +481,7 @@ RB.CommentDialogView = Backbone.View.extend({
     /**
      * Open the comment dialog and focuses the text field.
      */
-    open() {
+   open() {
         function openDialog() {
             this.$el.scrollIntoView();
             this._textEditor.focus();
@@ -432,7 +489,7 @@ RB.CommentDialogView = Backbone.View.extend({
 
         this.$el
             .css({
-                top: parseInt(this.$el.css('top'), 10) - this.SLIDE_DISTANCE,
+                top:'20%',
                 opacity: 0,
             })
             .show();
@@ -620,7 +677,6 @@ RB.CommentDialogView = Backbone.View.extend({
             this.close();
         }
     },
-
     /**
      * Callback for when the Delete button is pressed.
      *
@@ -632,7 +688,6 @@ RB.CommentDialogView = Backbone.View.extend({
             this.close();
         }
     },
-
     /**
      * Callback for keydown events in the text field.
      *
diff --git a/reviewboard/static/rb/js/views/tests/commentDialogViewTests.js b/reviewboard/static/rb/js/views/tests/commentDialogViewTests.js
index a39d37e3b54a03c2cf579414705a9e07199c8146..357f7ab3bf51d21905bbc33ad173359e2519f29d 100644
--- a/reviewboard/static/rb/js/views/tests/commentDialogViewTests.js
+++ b/reviewboard/static/rb/js/views/tests/commentDialogViewTests.js
@@ -852,6 +852,19 @@ suite('rb/views/CommentDialogView', function() {
             });
         });
 
+        describe('Position of dialog', function(){
+            beforeEach(function(){
+                dlg.open();
+            });
+
+            it('Mousedown/Mouseup on dialog', function(){
+                dlg.$el.trigger('mousedown');
+                expect(dlg.$el.css('position')).toBe('absolute');
+                dlg.$el.trigger('mouseup');
+                expect(dlg.$el.css('position')).toBe('fixed');
+            });
+        });
+
         describe('Title text', function() {
             var $title;
 
