Skip to content

Commit bcfdbb9

Browse files
Lookup: avoid selection by tab action (#28276)
1 parent 301d8c0 commit bcfdbb9

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

packages/devextreme/js/__internal/ui/m_lookup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ const Lookup = DropDownList.inherit({
541541
return 'auto';
542542
},
543543

544+
_allowSelectItemByTab: () => false,
545+
544546
_popupTabHandler(e) {
545547
const shouldLoopFocusInsidePopup = this._shouldLoopFocusInsidePopup();
546548

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/lookup.tests.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3016,6 +3016,28 @@ QUnit.module('keyboard navigation', {
30163016
assert.ok(instance.option('opened'), 'popup is opened');
30173017
});
30183018

3019+
QUnit.test('lookup value should not be changed after pressing tab', function(assert) {
3020+
if(devices.real().deviceType !== 'desktop') {
3021+
assert.ok(true, 'test does not actual for mobile devices');
3022+
return;
3023+
}
3024+
3025+
const $element = $('#widget').dxLookup({
3026+
opened: true,
3027+
items: [1, 2, 3],
3028+
focusStateEnabled: true,
3029+
searchEnabled: false,
3030+
});
3031+
const instance = $element.dxLookup('instance');
3032+
const $input = $(instance.field());
3033+
const keyboard = keyboardMock($input);
3034+
3035+
$input.trigger('focusin');
3036+
keyboard.keyDown('tab');
3037+
3038+
assert.strictEqual(instance.option('value'), null, 'Lookup input field has no value');
3039+
});
3040+
30193041
QUnit.testInActiveWindow('lookup item should be selected after \'enter\' key pressing', function(assert) {
30203042
if(devices.real().deviceType !== 'desktop') {
30213043
assert.ok(true, 'test does not actual for mobile devices');

0 commit comments

Comments
 (0)