diff --git a/lib/editor/atto/plugins/table/lang/en/atto_table.php b/lib/editor/atto/plugins/table/lang/en/atto_table.php
index d05c6c955a6..64190e5fce5 100644
--- a/lib/editor/atto/plugins/table/lang/en/atto_table.php
+++ b/lib/editor/atto/plugins/table/lang/en/atto_table.php
@@ -32,8 +32,8 @@ $string['columns'] = 'Columns';
 $string['rows'] = 'Rows';
 $string['both'] = 'Both';
 $string['edittable'] = 'Edit table';
-$string['addrowafter'] = 'Add row after';
-$string['addcolumnafter'] = 'Add column after';
+$string['addrowafter'] = 'Insert row after current cell';
+$string['addcolumnafter'] = 'Insert column after current cell';
 $string['moverowup'] = 'Move row up';
 $string['moverowdown'] = 'Move row down';
 $string['movecolumnleft'] = 'Move column left';
diff --git a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js
index 3b0aee9fb41..8e9c9a5cc07 100644
--- a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js
+++ b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js
@@ -296,7 +296,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
 
         // Show the context menu, and align to the current position.
         this._contextMenu.show();
-        this._contextMenu.align(e.tableCell, [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BL]);
+        this._contextMenu.align(this.buttons.table, [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BL]);
 
         // If there are any anchors in the bounding box, focus on the first.
         if (boundingBox.one('a')) {
diff --git a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js
index 77791a01d74..5fd06f0e25d 100644
--- a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js
+++ b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js
@@ -1,2 +1,2 @@
-YUI.add("moodle-atto_table-button",function(e,t){var n="atto_table",r='<form class="atto_form"><label for="{{elementid}}_atto_table_caption">{{get_string "caption" component}}</label><input class="caption fullwidth" id="{{elementid}}_atto_table_caption" required /><br/><label for="{{elementid}}_atto_table_headers" class="sameline">{{get_string "headers" component}}</label><select class="headers" id="{{elementid}}_atto_table_headers"><option value="columns">{{get_string "columns" component}}</option><option value="rows">{{get_string "rows" component}}</option><option value="both">{{get_string "both" component}}</option></select><br/><label for="{{elementid}}_atto_table_rows" class="sameline">{{get_string "numberofrows" component}}</label><input class="rows" type="number" value="3" id="{{elementid}}_atto_table_rows" size="8" min="1" max="50"/><br/><label for="{{elementid}}_atto_table_columns" class="sameline">{{get_string "numberofcolumns" component}}</label><input class="columns" type="number" value="3" id="{{elementid}}_atto_table_columns" size="8" min="1" max="20"/><br/><div class="mdl-align"><br/><button class="submit" type="submit">{{get_string "createtable" component}}</button></div></form>',i='<ul><li><a href="#" data-change="addcolumnafter">{{get_string "addcolumnafter" component}}</a></li><li><a href="#" data-change="addrowafter">{{get_string "addrowafter" component}}</a></li><li><a href="#" data-change="moverowup">{{get_string "moverowup" component}}</a></li><li><a href="#" data-change="moverowdown">{{get_string "moverowdown" component}}</a></li><li><a href="#" data-change="movecolumnleft">{{get_string "movecolumnleft" component}}</a></li><li><a href="#" data-change="movecolumnright">{{get_string "movecolumnright" component}}</a></li><li><a href="#" data-change="deleterow">{{get_string "deleterow" component}}</a></li><li><a href="#" data-change="deletecolumn">{{get_string "deletecolumn" component}}</a></li></ul>';CSS={},e.namespace("M.atto_table").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_contextMenu:null,_lastTarget:null,initializer:function(){this.addButton({icon:"e/table",callback:this._displayTableEditor,tags:"table"}),e.UA.gecko&&(document.execCommand("enableInlineTableEditing",!1,!1),document.execCommand("enableObjectResizing",!1,!1))},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection!==!1&&!this._currentSelection.collapsed){var e=this.getDialogue({headerContent:M.util.get_string("createtable",n),focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()).show()}},_displayTableEditor:function(t){var n=this.get("host").getSelectionParentNode(),r;return n?(e.one(n).ancestors("th, td",!0).each(function(e){this.editor.contains(e)&&(r=e)},this),r?(t.tableCell=r,this._showTableMenu(t)):this._displayDialogue(t)):this._displayDialogue(t)},_getDialogueContent:function(){var t=e.Handlebars.compile(r);return this._content=e.Node.create(t({CSS:CSS,elementid:this.get("host").get("elementid"),component:n})),this._content.one(".submit").on("click",this._setTable,this),this._content},_setTable:function(t){var n,r,i,s,o,u,a;t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=t.currentTarget.ancestor(".atto_form").one(".caption"),r=t.currentTarget.ancestor(".atto_form").one(".rows"),i=t.currentTarget.ancestor(".atto_form").one(".columns"),s=t.currentTarget.ancestor(".atto_form").one(".headers"),this.get("host").setSelection(this._currentSelection);var f="\n";o="<br/>"+f+"<table>"+f,o+="<caption>"+e.Escape.html(n.get("value"))+"</caption>"+f,u=0;if(s.get("value")==="columns"||s.get("value")==="both"){u=1,o+="<thead>"+f+"<tr>"+f;for(a=0;a<parseInt(i.get("value"),10);a++)o+='<th scope="col"></th>'+f;o+="</tr>"+f+"</thead>"+f}o+="<tbody>"+f;for(;u<parseInt(r.get("value"),10);u++){o+="<tr>"+f;for(a=0;a<parseInt(i.get("value"),10);a++)a!==0||s.get("value")!=="rows"&&s.get("value")!=="both"?o+="<td></td>"+f:o+='<th scope="row"></th>'+f;o+="</tr>"+f}o+="</tbody>"+f,o+="</table>"+f+"<br/>",this.get("host").insertContentAtFocusPoint(o),this.markUpdated()},_showTableMenu:function(t){t.preventDefault();var r;if(!this._contextMenu){var s=e.Handlebars.compile(i),o=e.Node.create(s({elementid:this.get("host").get("elementid"),component:n}));this._contextMenu=new e.M.editor_atto.Menu({headerText:M.util.get_string("edittable","atto_table"),bodyContent:o}),r=this._contextMenu.get("boundingBox"),r.delegate("click",this._handleTableChange,"a",this),r.delegate("key",this._handleTableChange,"down:enter,space","a",this)}r=this._contextMenu.get("boundingBox"),this._lastTarget=t.tableCell.ancestor(".editor_atto_content td, .editor_atto_content th",!0),this._contextMenu.show(),this._contextMenu.align(t.tableCell,[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),r.one("a")&&r.one("a").focus()},_handleTableChange:function(e){e.preventDefault(),this._contextMenu.hide();switch(e.target.getData("change")){case"addcolumnafter":this._addColumnAfter();break;case"addrowafter":this._addRowAfter();break;case"deleterow":this._deleteRow();break;case"deletecolumn":this._deleteColumn();break;case"moverowdown":this._moveRowDown();break;case"moverowup":this._moveRowUp();break;case"movecolumnleft":this._moveColumnLeft();break;case"movecolumnright":this._moveColumnRight()}},_getRowIndex:function(e){var t=e.ancestor("table"),n=e.ancestor("tr");if(!t||!n)return;var r=t.all("tr");return r.indexOf(n)},_getColumnIndex:function(e){var t=e.ancestor("tr");if(!t)return;var n=t.all("td, th");return n.indexOf(e)},_deleteRow:function(){var e=this._lastTarget.ancestor("tr");e&&e.one("td")&&e.remove(!0),this.markUpdated()},_moveRowUp:function(){var e=this._lastTarget.ancestor("tr"),t=e.previous("tr");if(!e||!t)return;e.swap(t),this.markUpdated()},_moveColumnLeft:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table").all("tr"),r=new e.NodeList,i=new e.NodeList,s=!1;n.each(function(e){var n=
-e.all("td, th"),o=n.item(t),u=n.item(t-1);r.push(o),u&&(u.get("tagName")==="TD"&&(s=!0),i.push(u))});if(s&&i.size()>0){var o=0;for(o=0;o<r.size();o++){var u=r.item(o),a=i.item(o);u.swap(a)}}this.markUpdated()},_moveColumnRight:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table").all("tr"),r=new e.NodeList,i=new e.NodeList,s=!1;n.each(function(e){var n=e.all("td, th"),o=n.item(t),u=n.item(t+1);o.get("tagName")==="TD"&&(s=!0),r.push(o),u&&i.push(u)});if(s&&i.size()>0){var o=0;for(o=0;o<r.size();o++){var u=r.item(o),a=i.item(o);u.swap(a)}}this.markUpdated()},_moveRowDown:function(){var e=this._lastTarget.ancestor("tr"),t=e.next("tr");if(!e||!t)return;e.swap(t),this.markUpdated()},_deleteColumn:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table").all("tr"),r=new e.NodeList,i=!1;n.each(function(e){var n=e.all("td, th"),s=n.item(t);s.get("tagName")==="TD"&&(i=!0),r.push(s)}),i&&r.remove(!0),this.markUpdated()},_addRowAfter:function(){var t=this._getRowIndex(this._lastTarget),n=this._lastTarget.ancestor("table").one("tbody");n||(n=this._lastTarget.ancestor("table"),t+=1);var r=n.one("tr");r||(r=this._lastTarget.ancestor("table").one("tr"));if(!r)return;newrow=r.cloneNode(!0),newrow.all("th, td").each(function(t){if(t.get("tagName")==="TH"&&t.getAttribute("scope")!=="row"){var n=e.Node.create("<td></td>");t.replace(n),t=n}t.setHTML("&nbsp;")}),n.insert(newrow,t),this.markUpdated()},_addColumnAfter:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table"),r=n.all("tr");e.each(r,function(e){var n=e.one("td, th").cloneNode(!0);n.setHTML("&nbsp;"),e.insert(n,t+1)},this),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-editor_atto-menu","event","event-valuechange"]});
+YUI.add("moodle-atto_table-button",function(e,t){var n="atto_table",r='<form class="atto_form"><label for="{{elementid}}_atto_table_caption">{{get_string "caption" component}}</label><input class="caption fullwidth" id="{{elementid}}_atto_table_caption" required /><br/><label for="{{elementid}}_atto_table_headers" class="sameline">{{get_string "headers" component}}</label><select class="headers" id="{{elementid}}_atto_table_headers"><option value="columns">{{get_string "columns" component}}</option><option value="rows">{{get_string "rows" component}}</option><option value="both">{{get_string "both" component}}</option></select><br/><label for="{{elementid}}_atto_table_rows" class="sameline">{{get_string "numberofrows" component}}</label><input class="rows" type="number" value="3" id="{{elementid}}_atto_table_rows" size="8" min="1" max="50"/><br/><label for="{{elementid}}_atto_table_columns" class="sameline">{{get_string "numberofcolumns" component}}</label><input class="columns" type="number" value="3" id="{{elementid}}_atto_table_columns" size="8" min="1" max="20"/><br/><div class="mdl-align"><br/><button class="submit" type="submit">{{get_string "createtable" component}}</button></div></form>',i='<ul><li><a href="#" data-change="addcolumnafter">{{get_string "addcolumnafter" component}}</a></li><li><a href="#" data-change="addrowafter">{{get_string "addrowafter" component}}</a></li><li><a href="#" data-change="moverowup">{{get_string "moverowup" component}}</a></li><li><a href="#" data-change="moverowdown">{{get_string "moverowdown" component}}</a></li><li><a href="#" data-change="movecolumnleft">{{get_string "movecolumnleft" component}}</a></li><li><a href="#" data-change="movecolumnright">{{get_string "movecolumnright" component}}</a></li><li><a href="#" data-change="deleterow">{{get_string "deleterow" component}}</a></li><li><a href="#" data-change="deletecolumn">{{get_string "deletecolumn" component}}</a></li></ul>';CSS={},e.namespace("M.atto_table").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_contextMenu:null,_lastTarget:null,initializer:function(){this.addButton({icon:"e/table",callback:this._displayTableEditor,tags:"table"}),e.UA.gecko&&(document.execCommand("enableInlineTableEditing",!1,!1),document.execCommand("enableObjectResizing",!1,!1))},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection!==!1&&!this._currentSelection.collapsed){var e=this.getDialogue({headerContent:M.util.get_string("createtable",n),focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()).show()}},_displayTableEditor:function(t){var n=this.get("host").getSelectionParentNode(),r;return n?(e.one(n).ancestors("th, td",!0).each(function(e){this.editor.contains(e)&&(r=e)},this),r?(t.tableCell=r,this._showTableMenu(t)):this._displayDialogue(t)):this._displayDialogue(t)},_getDialogueContent:function(){var t=e.Handlebars.compile(r);return this._content=e.Node.create(t({CSS:CSS,elementid:this.get("host").get("elementid"),component:n})),this._content.one(".submit").on("click",this._setTable,this),this._content},_setTable:function(t){var n,r,i,s,o,u,a;t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=t.currentTarget.ancestor(".atto_form").one(".caption"),r=t.currentTarget.ancestor(".atto_form").one(".rows"),i=t.currentTarget.ancestor(".atto_form").one(".columns"),s=t.currentTarget.ancestor(".atto_form").one(".headers"),this.get("host").setSelection(this._currentSelection);var f="\n";o="<br/>"+f+"<table>"+f,o+="<caption>"+e.Escape.html(n.get("value"))+"</caption>"+f,u=0;if(s.get("value")==="columns"||s.get("value")==="both"){u=1,o+="<thead>"+f+"<tr>"+f;for(a=0;a<parseInt(i.get("value"),10);a++)o+='<th scope="col"></th>'+f;o+="</tr>"+f+"</thead>"+f}o+="<tbody>"+f;for(;u<parseInt(r.get("value"),10);u++){o+="<tr>"+f;for(a=0;a<parseInt(i.get("value"),10);a++)a!==0||s.get("value")!=="rows"&&s.get("value")!=="both"?o+="<td></td>"+f:o+='<th scope="row"></th>'+f;o+="</tr>"+f}o+="</tbody>"+f,o+="</table>"+f+"<br/>",this.get("host").insertContentAtFocusPoint(o),this.markUpdated()},_showTableMenu:function(t){t.preventDefault();var r;if(!this._contextMenu){var s=e.Handlebars.compile(i),o=e.Node.create(s({elementid:this.get("host").get("elementid"),component:n}));this._contextMenu=new e.M.editor_atto.Menu({headerText:M.util.get_string("edittable","atto_table"),bodyContent:o}),r=this._contextMenu.get("boundingBox"),r.delegate("click",this._handleTableChange,"a",this),r.delegate("key",this._handleTableChange,"down:enter,space","a",this)}r=this._contextMenu.get("boundingBox"),this._lastTarget=t.tableCell.ancestor(".editor_atto_content td, .editor_atto_content th",!0),this._contextMenu.show(),this._contextMenu.align(this.buttons.table,[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),r.one("a")&&r.one("a").focus()},_handleTableChange:function(e){e.preventDefault(),this._contextMenu.hide();switch(e.target.getData("change")){case"addcolumnafter":this._addColumnAfter();break;case"addrowafter":this._addRowAfter();break;case"deleterow":this._deleteRow();break;case"deletecolumn":this._deleteColumn();break;case"moverowdown":this._moveRowDown();break;case"moverowup":this._moveRowUp();break;case"movecolumnleft":this._moveColumnLeft();break;case"movecolumnright":this._moveColumnRight()}},_getRowIndex:function(e){var t=e.ancestor("table"),n=e.ancestor("tr");if(!t||!n)return;var r=t.all("tr");return r.indexOf(n)},_getColumnIndex:function(e){var t=e.ancestor("tr");if(!t)return;var n=t.all("td, th");return n.indexOf(e)},_deleteRow:function(){var e=this._lastTarget.ancestor("tr");e&&e.one("td")&&e.remove(!0),this.markUpdated()},_moveRowUp:function(){var e=this._lastTarget.ancestor("tr"),t=e.previous("tr");if(!e||!t)return;e.swap(t),this.markUpdated()},_moveColumnLeft:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table").all("tr"),r=new e.NodeList,i=new e.NodeList,s=!1;n.each(function(
+e){var n=e.all("td, th"),o=n.item(t),u=n.item(t-1);r.push(o),u&&(u.get("tagName")==="TD"&&(s=!0),i.push(u))});if(s&&i.size()>0){var o=0;for(o=0;o<r.size();o++){var u=r.item(o),a=i.item(o);u.swap(a)}}this.markUpdated()},_moveColumnRight:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table").all("tr"),r=new e.NodeList,i=new e.NodeList,s=!1;n.each(function(e){var n=e.all("td, th"),o=n.item(t),u=n.item(t+1);o.get("tagName")==="TD"&&(s=!0),r.push(o),u&&i.push(u)});if(s&&i.size()>0){var o=0;for(o=0;o<r.size();o++){var u=r.item(o),a=i.item(o);u.swap(a)}}this.markUpdated()},_moveRowDown:function(){var e=this._lastTarget.ancestor("tr"),t=e.next("tr");if(!e||!t)return;e.swap(t),this.markUpdated()},_deleteColumn:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table").all("tr"),r=new e.NodeList,i=!1;n.each(function(e){var n=e.all("td, th"),s=n.item(t);s.get("tagName")==="TD"&&(i=!0),r.push(s)}),i&&r.remove(!0),this.markUpdated()},_addRowAfter:function(){var t=this._getRowIndex(this._lastTarget),n=this._lastTarget.ancestor("table").one("tbody");n||(n=this._lastTarget.ancestor("table"),t+=1);var r=n.one("tr");r||(r=this._lastTarget.ancestor("table").one("tr"));if(!r)return;newrow=r.cloneNode(!0),newrow.all("th, td").each(function(t){if(t.get("tagName")==="TH"&&t.getAttribute("scope")!=="row"){var n=e.Node.create("<td></td>");t.replace(n),t=n}t.setHTML("&nbsp;")}),n.insert(newrow,t),this.markUpdated()},_addColumnAfter:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table"),r=n.all("tr");e.each(r,function(e){var n=e.one("td, th").cloneNode(!0);n.setHTML("&nbsp;"),e.insert(n,t+1)},this),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-editor_atto-menu","event","event-valuechange"]});
diff --git a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js
index 3b0aee9fb41..8e9c9a5cc07 100644
--- a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js
+++ b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js
@@ -296,7 +296,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
 
         // Show the context menu, and align to the current position.
         this._contextMenu.show();
-        this._contextMenu.align(e.tableCell, [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BL]);
+        this._contextMenu.align(this.buttons.table, [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BL]);
 
         // If there are any anchors in the bounding box, focus on the first.
         if (boundingBox.one('a')) {
diff --git a/lib/editor/atto/plugins/table/yui/src/button/js/button.js b/lib/editor/atto/plugins/table/yui/src/button/js/button.js
index 144773bddef..5cc18aaa720 100644
--- a/lib/editor/atto/plugins/table/yui/src/button/js/button.js
+++ b/lib/editor/atto/plugins/table/yui/src/button/js/button.js
@@ -294,7 +294,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
 
         // Show the context menu, and align to the current position.
         this._contextMenu.show();
-        this._contextMenu.align(e.tableCell, [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BL]);
+        this._contextMenu.align(this.buttons.table, [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BL]);
 
         // If there are any anchors in the bounding box, focus on the first.
         if (boundingBox.one('a')) {