Skip to content

Commit 458e4f8

Browse files
authored
feat: Introduce initial screen reader support (experimental) (#684)
Fixes part of RaspberryPiFoundation/blockly#3370 Fixes part of RaspberryPiFoundation/blockly#9283 This PR introduces the plugin corresponding changes needed by RaspberryPiFoundation/blockly#9280. In particular, this: - Introduces CI workflow updates so that "tip-of-tree" is redefined as the corresponding experimental branch in core for screen reader support (to ensure CI passes here for changes that happen there). - Removes some access error overrides since the corresponding field was made public in the core PR (which is the root of the CI failures here). - Introduces some general instructions in the navigation plugin playground for folks testing Blockly with a screen reader (and points to #673 for discussion). **Important**: Note that this PR's changes will NOT be merged into the `main` branch as-is. They will be reconsidered entirely (and likely largely reimplemented) separately from this experimental branch and submitted as a separate, future review for `main`. See RaspberryPiFoundation/blockly#9280 and Fixes part of RaspberryPiFoundation/blockly#9283 for more specifics on why the separate branch thing is being set up this way.
1 parent 3696e2b commit 458e4f8

File tree

5 files changed

+38
-63
lines changed

5 files changed

+38
-63
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ on:
66
pull_request:
77
push:
88
branches:
9-
- main
9+
- add-screen-reader-support-experimental
1010

1111
permissions:
1212
contents: read
1313

1414
jobs:
1515
build_tip_of_tree_v12:
16-
name: Build test (against tip-of-tree core develop)
16+
name: Build test (against add-screen-reader-support-experimental core develop)
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout experimentation plugin
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/checkout@v4
2626
with:
2727
repository: 'google/blockly'
28-
ref: 'develop'
28+
ref: 'add-screen-reader-support-experimental'
2929
path: core-blockly
3030

3131
- name: Use Node.js 20.x
@@ -42,7 +42,7 @@ jobs:
4242
npm install
4343
cd ..
4444
45-
- name: Link latest Blockly develop
45+
- name: Link latest Blockly add-screen-reader-support-experimental
4646
run: |
4747
cd core-blockly
4848
npm run package
@@ -57,26 +57,6 @@ jobs:
5757
cd main
5858
npm run build
5959
60-
build:
61-
name: Build test (against pinned v12)
62-
# Don't run pinned version checks for PRs.
63-
if: ${{ !github.base_ref }}
64-
runs-on: ubuntu-latest
65-
steps:
66-
- name: Checkout experimentation plugin
67-
uses: actions/checkout@v4
68-
69-
- name: Use Node.js 20.x
70-
uses: actions/setup-node@v4
71-
with:
72-
node-version: 20.x
73-
74-
- name: NPM install
75-
run: npm install
76-
77-
- name: Verify build
78-
run: npm run build
79-
8060
lint:
8161
name: Eslint check
8262
timeout-minutes: 5

.github/workflows/test.yml

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ on:
77
pull_request:
88
push:
99
branches:
10-
- main
10+
- add-screen-reader-support-experimental
1111

1212
permissions:
1313
contents: read
1414

1515
jobs:
16-
webdriverio_tests_tip_of_tree_v12:
17-
name: WebdriverIO tests (against tip-of-tree core develop)
16+
webdriverio_tests:
17+
name: WebdriverIO tests (against add-screen-reader-support-experimental core develop)
1818
timeout-minutes: 10
1919
runs-on: ${{ matrix.os }}
2020

@@ -29,11 +29,11 @@ jobs:
2929
with:
3030
path: main
3131

32-
- name: Checkout core Blockly
32+
- name: Checkout experimentation Blockly
3333
uses: actions/checkout@v4
3434
with:
3535
repository: 'google/blockly'
36-
ref: 'develop'
36+
ref: 'add-screen-reader-support-experimental'
3737
path: core-blockly
3838

3939
- name: Use Node.js 20.x
@@ -50,7 +50,7 @@ jobs:
5050
npm install
5151
cd ..
5252
53-
- name: Link latest Blockly develop
53+
- name: Link latest Blockly add-screen-reader-support-experimental
5454
run: |
5555
cd core-blockly
5656
npm run package
@@ -64,30 +64,3 @@ jobs:
6464
run: |
6565
cd main
6666
npm run test
67-
68-
webdriverio_tests:
69-
name: WebdriverIO tests (against pinned v12)
70-
# Don't run pinned version checks for PRs.
71-
if: ${{ !github.base_ref }}
72-
timeout-minutes: 10
73-
runs-on: ${{ matrix.os }}
74-
75-
strategy:
76-
fail-fast: false
77-
matrix:
78-
os: [ubuntu-latest, macos-latest]
79-
80-
steps:
81-
- name: Checkout experimentation plugin
82-
uses: actions/checkout@v4
83-
84-
- name: Use Node.js 20.x
85-
uses: actions/setup-node@v4
86-
with:
87-
node-version: 20.x
88-
89-
- name: NPM install
90-
run: npm install
91-
92-
- name: Run tests
93-
run: npm run test

src/actions/mover.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,9 @@ export class Mover {
244244
this.patchDragger(info.dragger as dragging.Dragger, dragStrategy.moveType);
245245

246246
// Save the position so we can put the cursor in a reasonable spot.
247-
// @ts-expect-error Access to private property connectionCandidate.
248247
const target = dragStrategy.connectionCandidate?.neighbour;
249248

250249
// Prevent the strategy connecting the block so we just delete one block.
251-
// @ts-expect-error Access to private property connectionCandidate.
252250
dragStrategy.connectionCandidate = null;
253251

254252
info.dragger.onDragEnd(

src/keyboard_drag_strategy.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
5050
// to the top left of the workspace.
5151
// @ts-expect-error block and startLoc are private.
5252
this.block.moveDuringDrag(this.startLoc);
53-
// @ts-expect-error connectionCandidate is private.
5453
this.connectionCandidate = this.createInitialCandidate();
5554
this.forceShowPreview();
5655
this.block.addIcon(new MoveIcon(this.block));
@@ -62,9 +61,7 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
6261
super.drag(newLoc);
6362

6463
// Handle the case when an unconstrained drag found a connection candidate.
65-
// @ts-expect-error connectionCandidate is private.
6664
if (this.connectionCandidate) {
67-
// @ts-expect-error connectionCandidate is private.
6865
const neighbour = (this.connectionCandidate as ConnectionCandidate)
6966
.neighbour;
7067
// The next constrained move will resume the search from the current
@@ -253,7 +250,6 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
253250
private forceShowPreview() {
254251
// @ts-expect-error connectionPreviewer is private
255252
const previewer = this.connectionPreviewer;
256-
// @ts-expect-error connectionCandidate is private
257253
const candidate = this.connectionCandidate as ConnectionCandidate;
258254
if (!candidate || !previewer) return;
259255
const block = this.block;

test/index.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,34 @@
134134
</select>
135135
</div>
136136
</form>
137+
<div>
138+
<br />
139+
Instructions for screen reader support:
140+
<ul>
141+
<li>
142+
Enable a screen reader while on the page, and tab navigate/use
143+
arrow keys as normal.
144+
</li>
145+
<li>
146+
It's recommended to enable text output (sometimes a developer
147+
feature) so that you can see what the screen reader will read
148+
out (which allows it to be muted, or even just helps to follow
149+
along).
150+
</li>
151+
<li>
152+
It's recommended to use a keyboard shortcut for quickly
153+
enabling/disabling the screen reader to avoid needing to
154+
navigate back through menus to disable it.
155+
</li>
156+
</ul>
157+
For the primary discussion around screen reader support, please read
158+
and comment on: discussion
159+
<a
160+
href="https://github.com/google/blockly-keyboard-experimentation/discussions/673"
161+
target="_blank"
162+
>#673</a
163+
>.
164+
</div>
137165
</div>
138166
</div>
139167
<div id="blocklyDiv"></div>

0 commit comments

Comments
 (0)