Skip to content

Commit 8b21329

Browse files
fabihaahmedtakluyver
authored andcommitted
Narrator is not announcing "state of links"(enable or disable) under Edit tab. #3958 (#4733)
* Solved issue #3939 Further fixes issue #3939 and #3958 to work on windows browsers * Made some changes requested in the PR * Made some small tweaks * Restore missing semicolon
1 parent 6cfa66e commit 8b21329

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

notebook/static/notebook/js/notebook.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,7 @@ define([
11341134
var cell = this.get_cell(i);
11351135

11361136
$('#undelete_cell').addClass('disabled');
1137+
$('#undelete_cell > a').attr('aria-disabled','true');
11371138
if (this.is_valid_cell_index(i)) {
11381139
var old_ncells = this.ncells();
11391140
var ce = this.get_cell_element(i);
@@ -1213,7 +1214,7 @@ define([
12131214
// where they came from. It will do until we have proper undo support.
12141215
undelete_backup.index = cursor_ix_after;
12151216
$('#undelete_cell').removeClass('disabled');
1216-
1217+
$('#undelete_cell > a').attr('aria-disabled','false');
12171218
this.undelete_backup_stack.push(undelete_backup);
12181219
this.set_dirty(true);
12191220

@@ -1256,6 +1257,7 @@ define([
12561257
}
12571258
if (this.undelete_backup_stack.length === 0) {
12581259
$('#undelete_cell').addClass('disabled');
1260+
$('#undelete_cell > a').attr('aria-disabled','true');
12591261
}
12601262
};
12611263

@@ -1618,12 +1620,15 @@ define([
16181620
$('#paste_cell_replace').removeClass('disabled')
16191621
.on('click', function () {that.keyboard_manager.actions.call(
16201622
'jupyter-notebook:paste-cell-replace');});
1623+
$('#paste_cell_replace > a').attr('aria-disabled', 'false');
16211624
$('#paste_cell_above').removeClass('disabled')
16221625
.on('click', function () {that.keyboard_manager.actions.call(
16231626
'jupyter-notebook:paste-cell-above');});
1627+
$('#paste_cell_above > a').attr('aria-disabled', 'false');
16241628
$('#paste_cell_below').removeClass('disabled')
16251629
.on('click', function () {that.keyboard_manager.actions.call(
16261630
'jupyter-notebook:paste-cell-below');});
1631+
$('#paste_cell_below > a').attr('aria-disabled', 'false');
16271632
this.paste_enabled = true;
16281633
}
16291634
};
@@ -1634,8 +1639,11 @@ define([
16341639
Notebook.prototype.disable_paste = function () {
16351640
if (this.paste_enabled) {
16361641
$('#paste_cell_replace').addClass('disabled').off('click');
1642+
$('#paste_cell_replace > a').attr('aria-disabled', 'true');
16371643
$('#paste_cell_above').addClass('disabled').off('click');
1644+
$('#paste_cell_above > a').attr('aria-disabled', 'true');
16381645
$('#paste_cell_below').addClass('disabled').off('click');
1646+
$('#paste_cell_below > a').attr('aria-disabled', 'true');
16391647
this.paste_enabled = false;
16401648
}
16411649
};
@@ -1924,6 +1932,7 @@ define([
19241932
Notebook.prototype.disable_attachments_paste = function () {
19251933
if (this.paste_attachments_enabled) {
19261934
$('#paste_cell_attachments').addClass('disabled');
1935+
$('#paste_cell_attachments > a').attr('disabled','true');
19271936
this.paste_attachments_enabled = false;
19281937
}
19291938
};
@@ -1934,6 +1943,7 @@ define([
19341943
Notebook.prototype.enable_attachments_paste = function () {
19351944
if (!this.paste_attachments_enabled) {
19361945
$('#paste_cell_attachments').removeClass('disabled');
1946+
$('#paste_cell_attachments > a').attr('aria-disabled','false');
19371947
this.paste_attachments_enabled = true;
19381948
}
19391949
};
@@ -1944,8 +1954,10 @@ define([
19441954
Notebook.prototype.set_insert_image_enabled = function(enabled) {
19451955
if (enabled) {
19461956
$('#insert_image').removeClass('disabled');
1957+
$('#insert_image > a').attr('aria-disabled', 'false');
19471958
} else {
19481959
$('#insert_image').addClass('disabled');
1960+
$('#insert_image > a').attr('aria-disabled', 'true');
19491961
}
19501962
};
19511963

notebook/templates/notebook.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@
136136
<ul id="edit_menu" class="dropdown-menu" role="menu" aria-labelledby="editlink">
137137
<li id="cut_cell" role="none"><a href="#" role="menuitem">{% trans %}Cut Cells{% endtrans %}</a></li>
138138
<li id="copy_cell" role="none"><a href="#" role="menuitem">{% trans %}Copy Cells{% endtrans %}</a></li>
139-
<li id="paste_cell_above" class="disabled role="none"><a href="#" role="menuitem">{% trans %}Paste Cells Above{% endtrans %}</a></li>
140-
<li id="paste_cell_below" class="disabled" role="none"><a href="#" role="menuitem">{% trans %}Paste Cells Below{% endtrans %}</a></li>
141-
<li id="paste_cell_replace" class="disabled" role="none"><a href="#" role="menuitem">{% trans %}Paste Cells &amp; Replace{% endtrans %}</a></li>
139+
<li id="paste_cell_above" class="disabled" role="none"><a href="#" role="menuitem" aria-disabled="true">{% trans %}Paste Cells Above{% endtrans %}</a></li>
140+
<li id="paste_cell_below" class="disabled" role="none"><a href="#" role="menuitem" aria-disabled="true">{% trans %}Paste Cells Below{% endtrans %}</a></li>
141+
<li id="paste_cell_replace" class="disabled" role="none"><a href="#" role="menuitem" aria-disabled="true">{% trans %}Paste Cells &amp; Replace{% endtrans %}</a></li>
142142
<li id="delete_cell" role="none"><a href="#" role="menuitem">{% trans %}Delete Cells{% endtrans %}</a></li>
143-
<li id="undelete_cell" class="disabled" role="none"><a href="#" role="menuitem">{% trans %}Undo Delete Cells{% endtrans %}</a></li>
143+
<li id="undelete_cell" class="disabled" role="none"><a href="#" role="menuitem" aria-disabled="true">{% trans %}Undo Delete Cells{% endtrans %}</a></li>
144144
<li class="divider" role="none"></li>
145145
<li id="split_cell" role="none"><a href="#" role="menuitem">{% trans %}Split Cell{% endtrans %}</a></li>
146146
<li id="merge_cell_above" role="none"><a href="#" role="menuitem">{% trans %}Merge Cell Above{% endtrans %}</a></li>
@@ -155,9 +155,9 @@
155155
<li class="divider" role="none"></li>
156156
<li id="cut_cell_attachments" role="none"><a href="#" role="menuitem">{% trans %}Cut Cell Attachments{% endtrans %}</a></li>
157157
<li id="copy_cell_attachments" role="none"><a href="#" role="menuitem">{% trans %}Copy Cell Attachments{% endtrans %}</a></li>
158-
<li id="paste_cell_attachments" class="disabled" role="none"><a href="#" role="menuitem">{% trans %}Paste Cell Attachments{% endtrans %}</a></li>
158+
<li id="paste_cell_attachments" class="disabled" role="none"><a href="#" role="menuitem" aria-disabled="true">{% trans %}Paste Cell Attachments{% endtrans %}</a></li>
159159
<li class="divider" role="none"></li>
160-
<li id="insert_image" class="disabled" role="none"><a href="#" role="menuitem"> {% trans %}Insert Image{% endtrans %} </a></li>
160+
<li id="insert_image" class="disabled" role="none"><a href="#" role="menuitem" aria-disabled="true"> {% trans %}Insert Image{% endtrans %} </a></li>
161161
</ul>
162162
</li>
163163
<li class="dropdown"><a href="#" class="dropdown-toggle" id="viewlink" data-toggle="dropdown" aria-haspopup="true" aria-controls="view_menu">{% trans %}View{% endtrans %}</a>

0 commit comments

Comments
 (0)