Skip to content

Commit a86068b

Browse files
authored
chore: merge main into add-screen-reader branch (#726)
2 parents 458e4f8 + e4ad0d9 commit a86068b

30 files changed

+1680
-474
lines changed

.github/workflows/pages.yml

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
name: Deploy static content to Pages
33

44
on:
5-
# Runs on pushes targeting the default branch
5+
# Runs on pushes targeting the default and experimentation branches.
66
push:
7-
branches: ['main']
7+
branches:
8+
- main
9+
- add-screen-reader-support-experimental
810

9-
# Allows you to run this workflow manually from the Actions tab
11+
# Allows the workflow to be manually run from the Actions tab.
1012
workflow_dispatch:
1113

12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages.
1315
permissions:
1416
contents: read
1517
pages: write
@@ -26,45 +28,77 @@ jobs:
2628
build:
2729
runs-on: ubuntu-latest
2830
steps:
29-
- name: Checkout blockly
31+
- name: Checkout tip-of-tree core Blockly
3032
uses: actions/checkout@v4
3133
with:
3234
path: blockly
3335
repository: google/blockly
3436
ref: develop
3537

36-
- name: Checkout blockly-keyboard-experimentation
38+
- name: Checkout add-screen-reader-support-experimental core Blockly
39+
uses: actions/checkout@v4
40+
with:
41+
path: blockly-add-screen-reader-support-experimental
42+
repository: google/blockly
43+
ref: add-screen-reader-support-experimental
44+
45+
- name: Checkout tip-of-tree blockly-keyboard-experimentation
3746
uses: actions/checkout@v4
3847
with:
3948
path: blockly-keyboard-experimentation
4049

50+
- name: Checkout add-screen-reader-support-experimental blockly-keyboard-experimentation
51+
uses: actions/checkout@v4
52+
with:
53+
path: blockly-keyboard-experimentation-add-screen-reader-support-experimental
54+
ref: add-screen-reader-support-experimental
55+
4156
- name: Setup Node
4257
uses: actions/setup-node@v4
4358
with:
4459
node-version: 20.x
4560

46-
- name: Build blockly
61+
- name: Build tip-of-tree core Blockly
4762
run: |
4863
cd blockly
4964
npm ci
5065
npm run package
5166
cd dist
5267
npm link
53-
cd ../..
5468
55-
- name: Build blockly-keyboard-experimentation
69+
- name: Build tip-of-tree blockly-keyboard-experimentation
5670
run: |
5771
cd blockly-keyboard-experimentation
5872
npm ci
5973
npm link blockly
6074
npm run ghpages
61-
cd ..
75+
mkdir ../ghpages
76+
cp -r build/* ../ghpages/
77+
78+
- name: Build add-screen-reader-support-experimental core Blockly
79+
run: |
80+
cd blockly/dist
81+
npm unlink -g
82+
cd ../../blockly-add-screen-reader-support-experimental
83+
npm ci
84+
npm run package
85+
cd dist
86+
npm link
87+
88+
- name: Build add-screen-reader-support-experimental blockly-keyboard-experimentation
89+
run: |
90+
cd blockly-keyboard-experimentation-add-screen-reader-support-experimental
91+
npm ci
92+
npm link blockly
93+
npm run ghpages
94+
mkdir ../ghpages/screenreader
95+
cp -r build/* ../ghpages/screenreader/
6296
6397
- name: Upload artifact
6498
uses: actions/upload-pages-artifact@v3
6599
with:
66-
# Upload build folder
67-
path: './blockly-keyboard-experimentation/build'
100+
# Upload configured GH pages site files.
101+
path: './ghpages'
68102

69103
deploy:
70104
environment:

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ import {KeyboardNavigation} from '@blockly/keyboard-navigation';
7373
// Must be done before calling Blockly.inject.
7474
KeyboardNavigation.registerKeyboardNavigationStyles();
7575

76+
// Register the default toolbox. Only do this once per page-load.
77+
// Must be done before calling Blockly.inject.
78+
// See instructions below if you don't use the default toolbox.
79+
KeyboardNavigation.registerNavigationDeferringToolbox();
80+
7681
// Inject Blockly.
7782
const workspace = Blockly.inject('blocklyDiv', {
7883
toolbox: toolboxCategories,
@@ -81,7 +86,7 @@ const workspace = Blockly.inject('blocklyDiv', {
8186
const keyboardNav = new KeyboardNavigation(workspace);
8287
```
8388

84-
## Add shortcuts to page
89+
### Add shortcuts to page
8590

8691
In order to see the keyboard help popup when the user presses /, you need to add an empty div element to the hosting page that has the Blockly div element with the id "shortcuts". The plugin will take care of layout and formatting.
8792

@@ -93,7 +98,20 @@ In order to see the keyboard help popup when the user presses /, you need to add
9398
...
9499
```
95100

96-
### Usage with cross-tab-copy-paste plugin
101+
### Use with custom Toolbox implementation
102+
103+
If you supply your own subclass of `Toolbox`, you need to override the `onKeyDown_` method to make it a no-op. The base class has its own keyboard navigation built-in that you need to disable.
104+
105+
```js
106+
class YourCustomToolbox extends Blockly.Toolbox {
107+
protected override onKeyDown_(e: KeyboardEvent) {
108+
// No-op, prevent keyboard handling by superclass in order to defer to
109+
// global keyboard navigation.
110+
}
111+
}
112+
```
113+
114+
### Use with cross-tab-copy-paste plugin
97115

98116
This plugin adds context menu items for copying & pasting. It also adds feedback to copying & pasting as toasts that are shown to the user upon successful copy or cut. It is compatible with the `@blockly/plugin-cross-tab-copy-paste` by following these steps:
99117

0 commit comments

Comments
 (0)