Skip to content

Commit 9c4b5b1

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

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
@@ -2734,6 +2734,28 @@ QUnit.module('keyboard navigation', {
27342734
assert.ok(keyDownStub.calledOnce, 'keydown handled');
27352735
assert.ok(keyUpStub.calledOnce, 'keyup handled');
27362736
});
2737+
2738+
QUnit.testInActiveWindow('Popup should not close on tab press after search when applyValueMode is "useButtons" (T1230517)', function(assert) {
2739+
if(devices.real().deviceType !== 'desktop') {
2740+
assert.ok(true, 'desktop specific test');
2741+
return;
2742+
}
2743+
2744+
this.reinit({
2745+
focusStateEnabled: true,
2746+
items: ['first', 'second', 'third'],
2747+
opened: true,
2748+
searchEnabled: true,
2749+
applyValueMode: 'useButtons',
2750+
});
2751+
2752+
this.keyboard
2753+
.focus()
2754+
.type('s')
2755+
.press('tab');
2756+
2757+
assert.deepEqual(this.instance.option('opened'), true, 'popup is not closed');
2758+
});
27372759
});
27382760

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

0 commit comments

Comments
 (0)