diff --git a/mod/assign/feedback/editpdf/tests/behat/comment_popup_menu.feature b/mod/assign/feedback/editpdf/tests/behat/comment_popup_menu.feature
new file mode 100644
index 00000000000..d893aae1a58
--- /dev/null
+++ b/mod/assign/feedback/editpdf/tests/behat/comment_popup_menu.feature
@@ -0,0 +1,58 @@
+@mod @mod_assign @assignfeedback @assignfeedback_editpdf @javascript @_file_upload
+Feature: Ensure that a comment remains visible if its popup menu is open
+ In order to insert quick list comments in the PDF editor
+ As a teacher
+ I need the comment to stay visible when its popup menu is open
+
+ Background:
+ Given ghostscript is installed
+ And the following "courses" exist:
+ | fullname | shortname | category | groupmode |
+ | Course 1 | C1 | 0 | 1 |
+ And the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | Teacher | 1 | teacher1@example.com |
+ | student1 | Student | 1 | student1@example.com |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ | student1 | C1 | student |
+ And I log in as "teacher1"
+ And I am on "Course 1" course homepage with editing mode on
+ And I add a "Assignment" to section "1" and I fill the form with:
+ | Assignment name | Test assignment name |
+ | Description | Submit your PDF file |
+ | assignsubmission_file_enabled | 1 |
+ | assignfeedback_editpdf_enabled | 1 |
+ | Maximum number of uploaded files | 1 |
+ And I log out
+ And I log in as "student1"
+ And I am on "Course 1" course homepage
+ And I follow "Test assignment name"
+ And I press "Add submission"
+ And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
+ And I press "Save changes"
+ And I should see "Submitted for grading"
+ And I should see "submission.pdf"
+ And I should see "Not graded"
+ And I log out
+ And I log in as "teacher1"
+ And I am on "Course 1" course homepage
+ And I follow "Test assignment name"
+ And I navigate to "View all submissions" in current page administration
+ And I click on "Grade" "link" in the "Submitted for grading" "table_row"
+ And I wait for the complete PDF to load
+
+ Scenario: Add an empty comment and open its menu
+ When I click on ".commentbutton" "css_element"
+ And I draw on the pdf
+ And I click on ".commentdrawable a" "css_element"
+ Then ".drawingcanvas .commentdrawable" "css_element" should exist
+
+ Scenario: Add text to a comment and open its menu
+ When I click on ".commentbutton" "css_element"
+ And I draw on the pdf
+ And I set the field with xpath "//div[@class='commentdrawable']//textarea" to "Comment"
+ And I click on ".commentdrawable a" "css_element"
+ Then ".drawingcanvas .commentdrawable" "css_element" should exist
+ And the "class" attribute of ".drawingcanvas .commentdrawable" "css_element" should not contain "commentcollapsed"
diff --git a/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js b/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js
index b9134d31cb5..4d42b7ed68b 100644
--- a/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js
+++ b/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js
@@ -2607,11 +2607,20 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
* @method delete_comment_later
*/
this.delete_comment_later = function() {
- if (this.deleteme) {
+ if (this.deleteme && !this.is_menu_active()) {
this.remove();
}
};
+ /**
+ * Returns true if the menu is active, false otherwise.
+ *
+ * @return bool true if menu is active, else false.
+ */
+ this.is_menu_active = function() {
+ return this.menu.get('visible');
+ };
+
/**
* Comment nodes have a bunch of event handlers attached to them directly.
* This is all done here for neatness.
@@ -2629,11 +2638,11 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
// Function to collapse a comment to a marker icon.
node.collapse = function(delay) {
node.collapse.delay = Y.later(delay, node, function() {
- if (editor.collapsecomments) {
+ if (editor.collapsecomments && !this.is_menu_active()) {
container.addClass('commentcollapsed');
}
- });
- };
+ }.bind(this));
+ }.bind(this);
// Function to expand a comment.
node.expand = function() {
diff --git a/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js b/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js
index eef5759e094..952f9173278 100644
--- a/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js
+++ b/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js
@@ -2,8 +2,8 @@ YUI.add("moodle-assignfeedback_editpdf-editor",function(u,t){var e,i,s,n,a,o,r,d
this.x=e.x,this.y=e.y,this.endx=e.x+e.width,this.endy=e.y+e.height,this.colour=t.annotationcolour,this.path="",e.has_min_width()&&e.has_min_height()}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.annotation=n,(a=function(t){a.superclass.constructor.apply(this,[t])}).NAME="annotationline",a.ATTRS={},u.extend(a,M.assignfeedback_editpdf.annotation,{draw:function(){var t,e;return t=new M.assignfeedback_editpdf.drawable(this.editor),(e=this.editor.graphic.addShape({type:u.Path,fill:!1,stroke:{weight:st,color:tt[this.colour]}})).moveTo(this.x,this.y),e.lineTo(this.endx,this.endy),e.end(),t.shapes.push(e),this.drawable=t,a.superclass.draw.apply(this)},draw_current_edit:function(t){var e,i=new M.assignfeedback_editpdf.drawable(this.editor);return(e=this.editor.graphic.addShape({type:u.Path,fill:!1,stroke:{weight:st,color:tt[t.annotationcolour]}})).moveTo(t.start.x,t.start.y),e.lineTo(t.end.x,t.end.y),e.end(),i.shapes.push(e),i},init_from_edit:function(t){return this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.start.x,this.y=t.start.y,this.endx=t.end.x,this.endy=t.end.y,this.colour=t.annotationcolour,this.path="",!(this.endx-this.x==0&&this.endy-this.y==0)}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.annotationline=a,(o=function(t){o.superclass.constructor.apply(this,[t])}).NAME="annotationrectangle",o.ATTRS={},u.extend(o,M.assignfeedback_editpdf.annotation,{draw:function(){var t,e,i;return t=new M.assignfeedback_editpdf.drawable(this.editor),(e=new M.assignfeedback_editpdf.rect).bound([new M.assignfeedback_editpdf.point(this.x,this.y),new M.assignfeedback_editpdf.point(this.endx,this.endy)]),i=this.editor.graphic.addShape({type:u.Rect,width:e.width,height:e.height,stroke:{weight:st,color:tt[this.colour]},x:e.x,y:e.y}),t.shapes.push(i),this.drawable=t,o.superclass.draw.apply(this)},draw_current_edit:function(t){var e,i,s=new M.assignfeedback_editpdf.drawable(this.editor);return(i=new M.assignfeedback_editpdf.rect).bound([new M.assignfeedback_editpdf.point(t.start.x,t.start.y),new M.assignfeedback_editpdf.point(t.end.x,t.end.y)]),i.has_min_width()||i.set_min_width(),i.has_min_height()||i.set_min_height(),e=this.editor.graphic.addShape({type:u.Rect,width:i.width,height:i.height,stroke:{weight:st,color:tt[t.annotationcolour]},x:i.x,y:i.y}),s.shapes.push(e),s}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.annotationrectangle=o,(r=function(t){r.superclass.constructor.apply(this,[t])}).NAME="annotationoval",r.ATTRS={},u.extend(r,M.assignfeedback_editpdf.annotation,{draw:function(){var t,e,i;return t=new M.assignfeedback_editpdf.drawable(this.editor),(e=new M.assignfeedback_editpdf.rect).bound([new M.assignfeedback_editpdf.point(this.x,this.y),new M.assignfeedback_editpdf.point(this.endx,this.endy)]),i=this.editor.graphic.addShape({type:u.Ellipse,width:e.width,height:e.height,stroke:{weight:st,color:tt[this.colour]},x:e.x,y:e.y}),t.shapes.push(i),this.drawable=t,r.superclass.draw.apply(this)},draw_current_edit:function(t){var e,i,s=new M.assignfeedback_editpdf.drawable(this.editor);return(i=new M.assignfeedback_editpdf.rect).bound([new M.assignfeedback_editpdf.point(t.start.x,t.start.y),new M.assignfeedback_editpdf.point(t.end.x,t.end.y)]),i.has_min_width()||i.set_min_width(),i.has_min_height()||i.set_min_height(),e=this.editor.graphic.addShape({type:u.Ellipse,width:i.width,height:i.height,stroke:{weight:st,color:tt[t.annotationcolour]},x:i.x,y:i.y}),s.shapes.push(e),s}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.annotationoval=r,(d=function(t){d.superclass.constructor.apply(this,[t])}).NAME="annotationpen",d.ATTRS={},u.extend(d,M.assignfeedback_editpdf.annotation,{draw:function(){var t,e,i,s,n;return t=new M.assignfeedback_editpdf.drawable(this.editor),e=this.editor.graphic.addShape({type:u.Path,fill:!1,stroke:{weight:st,color:tt[this.colour]}}),i=!0,s=this.path.split(":"),u.each(s,function(t){n=t.split(","),i?(e.moveTo(n[0],n[1]),i=!1):e.lineTo(n[0],n[1])},this),e.end(),t.shapes.push(e),this.drawable=t,d.superclass.draw.apply(this)},draw_current_edit:function(t){var e,i,s=new M.assignfeedback_editpdf.drawable(this.editor);return e=this.editor.graphic.addShape({type:u.Path,fill:!1,stroke:{weight:st,color:tt[t.annotationcolour]}}),i=!0,u.each(t.path,function(t){i?(e.moveTo(t.x,t.y),i=!1):e.lineTo(t.x,t.y)},this),e.end(),s.shapes.push(e),s},init_from_edit:function(t){var e=new M.assignfeedback_editpdf.rect,i=[],s=0;for(e.bound(t.path),s=0;s")).addClass("annotation"),t.addClass("stamp"),t.setStyles({position:"absolute",display:"inline-block",backgroundImage:"url("+this.editor.get_stamp_image_url(this.path)+")",width:this.endx-this.x,height:this.endy-this.y,backgroundSize:"100% 100%"}),s.append(t),t.setX(e.x),t.setY(e.y),i.store_position(t,e.x,e.y),this.editor.get("readonly")||(t.on("gesturemovestart",this.editor.edit_start,null,this.editor),t.on("gesturemove",this.editor.edit_move,null,this.editor),t.on("gesturemoveend",this.editor.edit_end,null,this.editor)),i.nodes.push(t),this.drawable=i,h.superclass.draw.apply(this)},draw_current_edit:function(t){var e,i,s=new M.assignfeedback_editpdf.rect,n=new M.assignfeedback_editpdf.drawable(this.editor),a=this.editor.get_dialogue_element(P);return s.bound([t.start,t.end]),i=this.editor.get_window_coordinates(new M.assignfeedback_editpdf.point(s.x,s.y)),(e=u.Node.create("