Skip to content

Commit b10f1af

Browse files
authored
chore: merge develop into add-screen-reader
chore: merge develop into add-screen-reader
2 parents d349a0c + 2649f51 commit b10f1af

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"devDependencies": {
103103
"@blockly/block-test": "^7.0.2",
104104
"@blockly/dev-tools": "^9.0.2",
105+
"@blockly/keyboard-navigation": "^3.0.1",
105106
"@blockly/theme-modern": "^7.0.1",
106107
"@hyperjump/browser": "^1.1.4",
107108
"@hyperjump/json-schema": "^1.5.0",

tests/playgrounds/advanced_playground.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
await loadScript(
1919
'../../node_modules/@blockly/theme-modern/dist/index.js',
2020
);
21+
await loadScript(
22+
'../../node_modules/@blockly/keyboard-navigation/dist/index.js',
23+
);
24+
25+
let kbNavigation;
2126

2227
function start() {
2328
setBackgroundColour();
@@ -47,6 +52,28 @@
4752
// Refresh theme.
4853
ws.setTheme(ws.getTheme());
4954
});
55+
56+
// Keyboard navigation options.
57+
const kbOptions = {
58+
'Enable keyboard navigation': false,
59+
};
60+
gui.remember(kbOptions);
61+
gui.add(kbOptions, 'Enable keyboard navigation').onChange((enabled) => {
62+
setupKeyboardNav(enabled, playground);
63+
});
64+
65+
// Set up keyboard navigation on page load
66+
setupKeyboardNav(kbOptions['Enable keyboard navigation'], playground);
67+
}
68+
69+
function setupKeyboardNav(enabled, playground) {
70+
if (enabled) {
71+
kbNavigation = new KeyboardNavigation(playground.getWorkspace());
72+
} else {
73+
if (kbNavigation) {
74+
kbNavigation.dispose();
75+
}
76+
}
5077
}
5178

5279
function initPlayground() {
@@ -101,6 +128,8 @@
101128
};
102129

103130
Blockly.ContextMenuItems.registerCommentOptions();
131+
KeyboardNavigation.registerKeyboardNavigationStyles();
132+
// TODO: register the navigation-deferring toolbox.
104133

105134
createPlayground(
106135
document.getElementById('root'),
@@ -153,6 +182,7 @@
153182
</style>
154183
</head>
155184
<body>
185+
<div id="shortcuts"></div>
156186
<div id="root"></div>
157187
</body>
158188
</html>

0 commit comments

Comments
 (0)