Skip to content

Commit 087aea2

Browse files
authored
Merge pull request #8734 from google/rc/v11.2.1
release: v11.2.1
2 parents 00fec12 + 50f390b commit 087aea2

12 files changed

Lines changed: 52 additions & 25 deletions

core/field_dropdown.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {Coordinate} from './utils/coordinate.js';
2929
import * as dom from './utils/dom.js';
3030
import * as parsing from './utils/parsing.js';
3131
import * as utilsString from './utils/string.js';
32-
import * as style from './utils/style.js';
3332
import {Svg} from './utils/svg.js';
3433

3534
/**
@@ -304,11 +303,6 @@ export class FieldDropdown extends Field<string> {
304303

305304
if (this.selectedMenuItem) {
306305
this.menu_!.setHighlighted(this.selectedMenuItem);
307-
style.scrollIntoContainerView(
308-
this.selectedMenuItem.getElement()!,
309-
dropDownDiv.getContentDiv(),
310-
true,
311-
);
312306
}
313307

314308
this.applyColour();

core/inject.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ export function inject(
7777
});
7878

7979
browserEvents.conditionalBind(subContainer, 'keydown', null, onKeyDown);
80+
browserEvents.conditionalBind(
81+
dropDownDiv.getContentDiv(),
82+
'keydown',
83+
null,
84+
onKeyDown,
85+
);
86+
const widgetContainer = WidgetDiv.getDiv();
87+
if (widgetContainer) {
88+
browserEvents.conditionalBind(widgetContainer, 'keydown', null, onKeyDown);
89+
}
8090

8191
return workspace;
8292
}

core/menu.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,14 @@ export class Menu {
260260
this.highlightedItem = item;
261261
// Bring the highlighted item into view. This has no effect if the menu is
262262
// not scrollable.
263-
const el = this.getElement() as Element;
264-
style.scrollIntoContainerView(item.getElement() as Element, el);
265-
266-
aria.setState(el, aria.State.ACTIVEDESCENDANT, item.getId());
263+
const el = this.getElement();
264+
if (el) {
265+
aria.setState(el, aria.State.ACTIVEDESCENDANT, item.getId());
266+
}
267+
item.getElement()?.scrollIntoView({
268+
block: 'nearest',
269+
inline: 'start',
270+
});
267271
}
268272
}
269273

core/utils/style.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// Former goog.module ID: Blockly.utils.style
88

99
import {Coordinate} from './coordinate.js';
10+
import * as deprecation from './deprecation.js';
1011
import {Rect} from './rect.js';
1112
import {Size} from './size.js';
1213

@@ -58,6 +59,7 @@ function getSizeInternal(element: Element): Size {
5859
* @returns Object with width/height properties.
5960
*/
6061
function getSizeWithDisplay(element: Element): Size {
62+
deprecation.warn(`Blockly.utils.style.getSizeWithDisplay()`, 'v11.2', 'v13');
6163
const offsetWidth = (element as HTMLElement).offsetWidth;
6264
const offsetHeight = (element as HTMLElement).offsetHeight;
6365
return new Size(offsetWidth, offsetHeight);
@@ -130,6 +132,7 @@ export function getViewportPageOffset(): Coordinate {
130132
* @returns The computed border widths.
131133
*/
132134
export function getBorderBox(element: Element): Rect {
135+
deprecation.warn(`Blockly.utils.style.getBorderBox()`, 'v11.2', 'v13');
133136
const left = parseFloat(getComputedStyle(element, 'borderLeftWidth'));
134137
const right = parseFloat(getComputedStyle(element, 'borderRightWidth'));
135138
const top = parseFloat(getComputedStyle(element, 'borderTopWidth'));
@@ -156,6 +159,12 @@ export function scrollIntoContainerView(
156159
container: Element,
157160
opt_center?: boolean,
158161
) {
162+
deprecation.warn(
163+
`Blockly.utils.style.scrollIntoContainerView()`,
164+
'v11.2',
165+
'v13',
166+
'the native Element.scrollIntoView()',
167+
);
159168
const offset = getContainerOffsetToScrollInto(element, container, opt_center);
160169
container.scrollLeft = offset.x;
161170
container.scrollTop = offset.y;
@@ -180,6 +189,11 @@ export function getContainerOffsetToScrollInto(
180189
container: Element,
181190
opt_center?: boolean,
182191
): Coordinate {
192+
deprecation.warn(
193+
`Blockly.utils.style.getContainerOffsetToScrollInto()`,
194+
'v11.2',
195+
'v13',
196+
);
183197
// Absolute position of the element's border's top left corner.
184198
const elementPos = getPageOffset(element);
185199
// Absolute position of the container's border's top left corner.

package-lock.json

Lines changed: 2 additions & 2 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blockly",
3-
"version": "11.2.0",
3+
"version": "11.2.1",
44
"description": "Blockly is a library for building visual programming editors.",
55
"keywords": [
66
"blockly"

scripts/gulpfiles/package_tasks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ module.exports = require('./${bundle}');
159159
* This task copies all the media/* files into the release directory.
160160
*/
161161
function packageMedia() {
162-
return gulp.src('media/*')
162+
return gulp.src('media/*', {encoding: false})
163163
.pipe(gulp.dest(`${RELEASE_DIR}/media`));
164164
};
165165

tests/browser/test/basic_playground_test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ suite('Disabling', function () {
137137
110,
138138
);
139139
await connect(this.browser, child, 'OUTPUT', parent, 'IF0');
140-
140+
await this.browser.pause(PAUSE_TIME);
141141
await contextMenuSelect(this.browser, parent, 'Disable Block');
142142

143143
chai.assert.isTrue(await getIsDisabled(this.browser, child.id));

tests/browser/test/delete_blocks_test.mjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,14 @@ suite('Delete blocks', function (done) {
123123
)
124124
.waitForExist({timeout: 2000, reverse: true});
125125

126-
// Load the start blocks
127-
await this.browser.execute((blocks) => {
128-
Blockly.serialization.workspaces.load(blocks, Blockly.getMainWorkspace());
129-
}, startBlocks);
126+
// Load the start blocks. This hangs indefinitely if `startBlocks` is
127+
// passed without being stringified.
128+
this.browser.execute((blocks) => {
129+
Blockly.serialization.workspaces.load(
130+
JSON.parse(blocks),
131+
Blockly.getMainWorkspace(),
132+
);
133+
}, JSON.stringify(startBlocks));
130134
// Wait for there to be a block on the main workspace before continuing
131135
(await getBlockElementById(this.browser, firstBlockId)).waitForExist({
132136
timeout: 2000,

tests/browser/test/procedure_test.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ suite('Testing Connecting Blocks', function (done) {
2626
// Setup Selenium for all of the tests
2727
suiteSetup(async function () {
2828
this.browser = await testSetup(testFileLocations.CODE_DEMO);
29+
// Prevent WebDriver from suppressing alerts
30+
// https://github.com/webdriverio/webdriverio/issues/13610#issuecomment-2357768103
31+
this.browser.on('dialog', (dialog) => {});
2932
});
3033

3134
test('Testing Procedure', async function () {

0 commit comments

Comments
 (0)