Skip to content

Commit 4b5e410

Browse files
authored
Merge pull request #1386 from katlich112358/Codetrap-fix
Reference page keyboard accessibility code block fix
2 parents b7df393 + fa0b2bb commit 4b5e410

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

src/assets/css/main.css

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ div.reference-subgroup {
674674
position: relative;
675675
left: 1em;
676676
padding-top: 0;
677-
margin-top: 1rem;
677+
margin-top: 3rem;
678678
border: none;
679679
width: 30.5em;
680680
max-width: 100%;
@@ -700,6 +700,7 @@ div.reference-subgroup {
700700

701701
.example-content .edit_space ul {
702702
display: flex;
703+
flex-wrap: wrap-reverse;
703704
flex-direction: row-reverse;
704705
position: relative;
705706
pointer-events: none;
@@ -721,6 +722,12 @@ div.reference-subgroup {
721722
border-color: rgba(45, 123, 182, 0.25);
722723
}
723724

725+
.example-content .edit_space ul li button:focus {
726+
color: #2d7bb6;
727+
border: 2px dotted;
728+
border-color: rgba(45, 123, 182, 0.25);
729+
}
730+
724731
.example-content .edit_space .edit_area {
725732
position: absolute;
726733
top: 0.5em;
@@ -732,7 +739,6 @@ div.reference-subgroup {
732739
padding: 1.5em 0.5em 0.5em 0.5em;
733740
font-size: 15pt;
734741
}
735-
736742
.display_button {
737743
margin-bottom: 2em;
738744
font-family: 'Montserrat', sans-serif;
@@ -743,6 +749,17 @@ div.reference-subgroup {
743749
outline: none;
744750
}
745751

752+
.sketchTabInstructions {
753+
flex-grow: 1;
754+
font-family: 'Montserrat', sans-serif;
755+
color: #CCC;
756+
font-size: 1em;
757+
font-style: italic;
758+
margin-left: 120px;
759+
margin-right: 1em;
760+
margin-top: .25em;
761+
}
762+
746763
.example-content .example_container {
747764
width: 36em;
748765
max-width: 100%;

src/assets/js/render.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ var renderCode = function(exampleName) {
1818

1919
function enableTab(el) {
2020
el.onkeydown = function(e) {
21-
if (e.keyCode === 9) {
22-
// tab was pressed
21+
if (e.keyCode === 32 && e.shiftKey) {
22+
// shift + space pressed
2323
// get caret position/selection
2424
var val = this.value,
2525
start = this.selectionStart,
@@ -85,7 +85,7 @@ var renderCode = function(exampleName) {
8585
edit_space.appendChild(edit_area);
8686
enableTab(edit_area);
8787

88-
//add buttons
88+
//add buttons and instructions
8989
let button_space = document.createElement('ul');
9090
edit_space.appendChild(button_space);
9191

@@ -134,6 +134,10 @@ var renderCode = function(exampleName) {
134134
let edit_li = button_space.appendChild(document.createElement('li'));
135135
edit_li.appendChild(edit_button);
136136

137+
let sketch_tab_instructions = button_space.appendChild(document.createElement('li'));
138+
sketch_tab_instructions.innerHTML = 'Press Shift-Space to insert tab.';
139+
sketch_tab_instructions.className = 'sketchTabInstructions';
140+
137141
function setMode(sketch, m) {
138142
if (m === 'edit') {
139143
$('.example_container').each(function(ind, con) {

0 commit comments

Comments
 (0)