Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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');
});
});
20 changes: 20 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,24 @@ 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);
await this.browser.keys('x');
await this.browser.keys(Key.Ctrl); // release ctrl key
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just use await this.browser.keys([Key.Ctrl, 'x']); instead? I think we do that elsewhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I guess so. The webdriver documentation includes a very confusing statement that modifier keys will be considered held down until you trigger them again, but then their example with copy and paste doesn't do anything related to that, so... I guess it's fine.


// 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'));
});
});
Loading