Skip to content

Commit d337117

Browse files
authored
TagBox: should not close on tab press after search when applyValueMode is "useButtons" (T1230517)
1 parent bf7f61f commit d337117

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ const SelectBox = (DropDownList as any).inherit({
4949

5050
return extend({}, parent, {
5151
tab() {
52-
if (this.option('opened') && !this._popup.getFocusableElements().length) {
52+
const { opened } = this.option();
53+
const popupHasFocusableElements = opened && !!this._popup.getFocusableElements().length;
54+
if (!popupHasFocusableElements) {
5355
this._resetCaretPosition(true);
5456
}
5557

5658
parent.tab && parent.tab.apply(this, arguments);
5759

58-
this._cancelSearchIfNeed();
60+
if (!popupHasFocusableElements) {
61+
this._cancelSearchIfNeed();
62+
}
5963
},
6064
upArrow(e) {
6165
if (parent.upArrow.apply(this, arguments)) {

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,6 +2726,28 @@ QUnit.module('keyboard navigation', {
27262726
assert.ok(keyDownStub.calledOnce, 'keydown handled');
27272727
assert.ok(keyUpStub.calledOnce, 'keyup handled');
27282728
});
2729+
2730+
QUnit.testInActiveWindow('Popup should not close on tab press after search when applyValueMode is "useButtons" (T1230517)', function(assert) {
2731+
if(devices.real().deviceType !== 'desktop') {
2732+
assert.ok(true, 'desktop specific test');
2733+
return;
2734+
}
2735+
2736+
this.reinit({
2737+
focusStateEnabled: true,
2738+
items: ['first', 'second', 'third'],
2739+
opened: true,
2740+
searchEnabled: true,
2741+
applyValueMode: 'useButtons',
2742+
});
2743+
2744+
this.keyboard
2745+
.focus()
2746+
.type('s')
2747+
.press('tab');
2748+
2749+
assert.deepEqual(this.instance.option('opened'), true, 'popup is not closed');
2750+
});
27292751
});
27302752

27312753
QUnit.module('keyboard navigation through tags', {

0 commit comments

Comments
 (0)