Skip to content

Commit 9881de1

Browse files
microbit-markmicrobit-carlos
authored andcommitted
A11y: Convert some links into accessible buttons (#313)
1 parent b4d1a16 commit 9881de1

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<h2 class="modal-title"><i class="fa fa-upload"></i> <strong>{{ load-title }}</strong></h2>
8787
<div class="load-drag-target" id="load-drag-target">
8888
<input type="file" style="display: none" name="load-form-file-upload" id="file-upload-input">
89-
<p>{{ instructions }}<br><a href="#" id="file-upload-link" class="load-drag-target load-toggle action">{{ toggle-file }}</a></p>
89+
<p>{{ instructions }}<br><button aria-labelledby="file-upload-link" type="button" id="file-upload-link" class="load-drag-target load-toggle button-link action">{{ toggle-file }}</button></p>
9090
</div>
9191
<h2 class="modal-title"><i class="fa fa-download"></i> <strong>{{ save-but }}</strong></h2>
9292
<div class="save-buttons-container">

python-main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,10 +1705,11 @@ function web_editor(config) {
17051705
if (links) {
17061706
Object.keys(links).forEach(function(key) {
17071707
if (links[key] === "close") {
1708-
modalLinks.push('<a href="#" id="modal-msg-close-link">' + key + '</a>');
1708+
modalLinks.push('<button type="button" area-labelledby="modal-msg-close-link" id="modal-msg-close-link">' + key + '</button>');
1709+
17091710
addCloseClickListener = true;
17101711
} else {
1711-
modalLinks.push('<a href="' + links[key] + '" target="_blank">' + key + '</a>');
1712+
modalLinks.push('<button type="button" aria-label="' + key + '" class="button-link" onclick="window.open(\' ' + links[key] + '\', \'_blank\')">' + key + '</button>');
17121713
}
17131714
});
17141715
}

static/css/style.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,20 @@ input:checked + .menu-switch-slider:before {
959959
float: right;
960960
}
961961

962+
.button-link {
963+
background: none;
964+
border: none;
965+
padding: 0;
966+
font-size: 1rem;
967+
color: #326699;
968+
text-decoration: underline;
969+
cursor: pointer;
970+
}
971+
972+
#file-upload-link {
973+
font-weight: bold ;
974+
}
975+
962976
.disabled {
963977
pointer-events: none;
964978
cursor: not-allowed;

0 commit comments

Comments
 (0)