From 3991a39ef607758f42295a6bf8d71e65d3b3f716 Mon Sep 17 00:00:00 2001 From: fabihaahmed Date: Thu, 20 Jun 2019 11:03:10 +0100 Subject: [PATCH 1/3] Fixes issue #3939, #3958 --- notebook/static/notebook/js/codecell.js | 2 +- notebook/static/notebook/js/notebook.js | 12 ++++++------ notebook/static/notebook/js/textcell.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/notebook/static/notebook/js/codecell.js b/notebook/static/notebook/js/codecell.js index 397420700..f9a24ef4e 100644 --- a/notebook/static/notebook/js/codecell.js +++ b/notebook/static/notebook/js/codecell.js @@ -178,7 +178,7 @@ define([ cell: this, notebook: this.notebook}); inner_cell.append(this.celltoolbar.element); - var input_area = $('
').addClass('input_area'); + var input_area = $('
').addClass('input_area').attr("aria-label", "Edit code here"); this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config); // In case of bugs that put the keyboard manager into an inconsistent state, // ensure KM is enabled when CodeMirror is focused: diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index 556f3999a..e40d4e719 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -1212,7 +1212,7 @@ define([ // This will put all the deleted cells back in one location, rather than // where they came from. It will do until we have proper undo support. undelete_backup.index = cursor_ix_after; - $('#undelete_cell').removeClass('disabled'); + $('#undelete_cell').removeClass('disabled').removeAttr("aria-label"); this.undelete_backup_stack.push(undelete_backup); this.set_dirty(true); @@ -1617,13 +1617,13 @@ define([ if (!this.paste_enabled) { $('#paste_cell_replace').removeClass('disabled') .on('click', function () {that.keyboard_manager.actions.call( - 'jupyter-notebook:paste-cell-replace');}); + 'jupyter-notebook:paste-cell-replace');}).removeAttr("aria-label"); $('#paste_cell_above').removeClass('disabled') .on('click', function () {that.keyboard_manager.actions.call( - 'jupyter-notebook:paste-cell-above');}); + 'jupyter-notebook:paste-cell-above');}).removeAttr("aria-label"); $('#paste_cell_below').removeClass('disabled') .on('click', function () {that.keyboard_manager.actions.call( - 'jupyter-notebook:paste-cell-below');}); + 'jupyter-notebook:paste-cell-below');}).removeAttr("aria-label"); this.paste_enabled = true; } }; @@ -1933,7 +1933,7 @@ define([ */ Notebook.prototype.enable_attachments_paste = function () { if (!this.paste_attachments_enabled) { - $('#paste_cell_attachments').removeClass('disabled'); + $('#paste_cell_attachments').removeClass('disabled').removeAttr("aria-label"); this.paste_attachments_enabled = true; } }; @@ -1943,7 +1943,7 @@ define([ */ Notebook.prototype.set_insert_image_enabled = function(enabled) { if (enabled) { - $('#insert_image').removeClass('disabled'); + $('#insert_image').removeClass('disabled').removeAttr("aria-label"); } else { $('#insert_image').addClass('disabled'); } diff --git a/notebook/static/notebook/js/textcell.js b/notebook/static/notebook/js/textcell.js index cb96faedf..ca26c9cd4 100644 --- a/notebook/static/notebook/js/textcell.js +++ b/notebook/static/notebook/js/textcell.js @@ -98,7 +98,7 @@ define([ cell: this, notebook: this.notebook}); inner_cell.append(this.celltoolbar.element); - var input_area = $('
').addClass('input_area'); + var input_area = $('
').addClass('input_area').attr("aria-label", "Edit Markup Text here");; this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config); // In case of bugs that put the keyboard manager into an inconsistent state, // ensure KM is enabled when CodeMirror is focused: From 70b0c73344ad05af8869a28ce0841164426b8578 Mon Sep 17 00:00:00 2001 From: fabihaahmed Date: Thu, 27 Jun 2019 14:06:36 +0100 Subject: [PATCH 2/3] Fixed a bug --- notebook/static/notebook/js/notebook.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index e40d4e719..556f3999a 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -1212,7 +1212,7 @@ define([ // This will put all the deleted cells back in one location, rather than // where they came from. It will do until we have proper undo support. undelete_backup.index = cursor_ix_after; - $('#undelete_cell').removeClass('disabled').removeAttr("aria-label"); + $('#undelete_cell').removeClass('disabled'); this.undelete_backup_stack.push(undelete_backup); this.set_dirty(true); @@ -1617,13 +1617,13 @@ define([ if (!this.paste_enabled) { $('#paste_cell_replace').removeClass('disabled') .on('click', function () {that.keyboard_manager.actions.call( - 'jupyter-notebook:paste-cell-replace');}).removeAttr("aria-label"); + 'jupyter-notebook:paste-cell-replace');}); $('#paste_cell_above').removeClass('disabled') .on('click', function () {that.keyboard_manager.actions.call( - 'jupyter-notebook:paste-cell-above');}).removeAttr("aria-label"); + 'jupyter-notebook:paste-cell-above');}); $('#paste_cell_below').removeClass('disabled') .on('click', function () {that.keyboard_manager.actions.call( - 'jupyter-notebook:paste-cell-below');}).removeAttr("aria-label"); + 'jupyter-notebook:paste-cell-below');}); this.paste_enabled = true; } }; @@ -1933,7 +1933,7 @@ define([ */ Notebook.prototype.enable_attachments_paste = function () { if (!this.paste_attachments_enabled) { - $('#paste_cell_attachments').removeClass('disabled').removeAttr("aria-label"); + $('#paste_cell_attachments').removeClass('disabled'); this.paste_attachments_enabled = true; } }; @@ -1943,7 +1943,7 @@ define([ */ Notebook.prototype.set_insert_image_enabled = function(enabled) { if (enabled) { - $('#insert_image').removeClass('disabled').removeAttr("aria-label"); + $('#insert_image').removeClass('disabled'); } else { $('#insert_image').addClass('disabled'); } From 76c39dcb83e50f88624e1f764ec467f8262654fd Mon Sep 17 00:00:00 2001 From: fabihaahmed Date: Thu, 11 Jul 2019 12:06:46 +0100 Subject: [PATCH 3/3] Made some changes as requested in the PR --- notebook/static/notebook/js/codecell.js | 2 +- notebook/static/notebook/js/textcell.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/notebook/static/notebook/js/codecell.js b/notebook/static/notebook/js/codecell.js index f9a24ef4e..786ad9413 100644 --- a/notebook/static/notebook/js/codecell.js +++ b/notebook/static/notebook/js/codecell.js @@ -178,7 +178,7 @@ define([ cell: this, notebook: this.notebook}); inner_cell.append(this.celltoolbar.element); - var input_area = $('
').addClass('input_area').attr("aria-label", "Edit code here"); + var input_area = $('
').addClass('input_area').attr("aria-label", i18n.msg._("Edit code here")); this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config); // In case of bugs that put the keyboard manager into an inconsistent state, // ensure KM is enabled when CodeMirror is focused: diff --git a/notebook/static/notebook/js/textcell.js b/notebook/static/notebook/js/textcell.js index ca26c9cd4..2953b8c98 100644 --- a/notebook/static/notebook/js/textcell.js +++ b/notebook/static/notebook/js/textcell.js @@ -98,7 +98,7 @@ define([ cell: this, notebook: this.notebook}); inner_cell.append(this.celltoolbar.element); - var input_area = $('
').addClass('input_area').attr("aria-label", "Edit Markup Text here");; + var input_area = $('
').addClass('input_area').attr("aria-label", i18n.msg._("Edit Markup Text here")); this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config); // In case of bugs that put the keyboard manager into an inconsistent state, // ensure KM is enabled when CodeMirror is focused: