Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,8 @@ export class Navigation {
: workspace.keyboardAccessibilityMode;
return (
!!accessibilityMode &&
this.getState(workspace) !== Constants.STATE.NOWHERE
this.getState(workspace) !== Constants.STATE.NOWHERE &&
!Blockly.getFocusManager().ephemeralFocusTaken()
);
}

Expand Down
14 changes: 14 additions & 0 deletions test/webdriverio/test/basic_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,18 @@ suite('Keyboard navigation on Fields', function () {
.expect(await getCurrentFocusedBlockId(this.browser))
.equal('draw_emoji_1');
});

test('Do not navigate while field editor is open', async function () {
// Open a field editor dropdown
await focusOnBlockField(this.browser, 'logic_boolean_1', 'BOOL');
await this.browser.pause(PAUSE_TIME);
await this.browser.keys(Key.Enter);
await this.browser.pause(PAUSE_TIME);

// Try to navigate to a different block
await keyRight(this.browser);

// The same field should still be focused
chai.assert.equal(await getFocusedFieldName(this.browser), 'BOOL');
});
});
18 changes: 18 additions & 0 deletions test/webdriverio/test/clipboard_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
ElementWithId,
tabNavigateToWorkspace,
focusOnBlock,
focusOnBlockField,
blockIsPresent,
} from './test_setup.js';
import {Key, KeyAction, PointerAction, WheelAction} from 'webdriverio';

Expand Down Expand Up @@ -111,6 +113,22 @@ suite('Clipboard test', function () {
'Blocks on the workspace should not have changed',
);
});

test('Do not cut block while field editor is open', async function () {
// Open a field editor
await focusOnBlockField(this.browser, 'draw_circle_1_color', 'COLOUR');
await this.browser.pause(PAUSE_TIME);
await this.browser.keys(Key.Enter);
await this.browser.pause(PAUSE_TIME);

// Try to cut block while field editor is open
await this.browser.keys([Key.Ctrl, 'x']);

// Block is not deleted
chai.assert.isTrue(
await blockIsPresent(this.browser, 'draw_circle_1_color'),
);
});
});

/**
Expand Down
15 changes: 15 additions & 0 deletions test/webdriverio/test/delete_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
PAUSE_TIME,
tabNavigateToWorkspace,
keyRight,
focusOnBlockField,
} from './test_setup.js';
import {Key} from 'webdriverio';

Expand Down Expand Up @@ -218,4 +219,18 @@ suite('Deleting Blocks', function () {
'p5_setup_1',
);
});

test('Do not delete block while field editor is open', async function () {
// Open a field editor
await focusOnBlockField(this.browser, 'colour_picker_1', 'COLOUR');
await this.browser.pause(PAUSE_TIME);
await this.browser.keys(Key.Enter);
await this.browser.pause(PAUSE_TIME);

// Try to delete block while field editor is open
await this.browser.keys(Key.Backspace);

// Block is not deleted
chai.assert.isTrue(await blockIsPresent(this.browser, 'colour_picker_1'));
});
});
8 changes: 2 additions & 6 deletions test/webdriverio/test/keyboard_mode_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ suite(
// Make sure we're on a copyable block so that copy occurs
await focusOnBlock(this.browser, 'controls_if_2');
await this.browser.pause(PAUSE_TIME);
await this.browser.keys(Key.Ctrl);
await this.browser.keys('c');
await this.browser.keys(Key.Ctrl); // release ctrl key
await this.browser.keys([Key.Ctrl, 'c']);
await this.browser.pause(PAUSE_TIME);

chai.assert.isFalse(await isKeyboardNavigating(this.browser));
Expand All @@ -92,9 +90,7 @@ suite(
});

await this.browser.pause(PAUSE_TIME);
await this.browser.keys(Key.Ctrl);
await this.browser.keys('c');
await this.browser.keys(Key.Ctrl); // release ctrl key
await this.browser.keys([Key.Ctrl, 'c']);
await this.browser.pause(PAUSE_TIME);

chai.assert.isTrue(await isKeyboardNavigating(this.browser));
Expand Down
Loading