diff --git a/packages/elements/src/tree/__test__/tree.test.js b/packages/elements/src/tree/__test__/tree.test.js
index cdd35a1e80..83df5d9e84 100644
--- a/packages/elements/src/tree/__test__/tree.test.js
+++ b/packages/elements/src/tree/__test__/tree.test.js
@@ -532,6 +532,46 @@ describe('tree/Tree', function () {
});
});
+ describe('Stateless Mode', function () {
+ it('Should expand/collapse when tapping on single mode parent', async function () {
+ const el = await fixture('');
+ el.data = nestedData;
+ await elementUpdated(el);
+
+ el.children[0].click();
+ await elementUpdated(el);
+ expect(el.children[0].expanded).to.be.false;
+
+ el.children[0].click();
+ await elementUpdated(el);
+ expect(el.children[0].expanded).to.be.true;
+ });
+
+ it('Should not expand/collapse when tapping on multiple mode parent', async function () {
+ const el = await fixture('');
+ el.data = nestedData;
+ await elementUpdated(el);
+
+ el.children[0].click();
+ await elementUpdated(el);
+ expect(el.children[0].expanded).to.be.true;
+
+ el.children[0].click();
+ await elementUpdated(el);
+ expect(el.children[0].expanded).to.be.true;
+ });
+
+ it('Should not select value when tapping on multiple mode parent', async function () {
+ const el = await fixture('');
+ el.data = nestedData;
+ await elementUpdated(el);
+
+ el.children[0].click();
+ await elementUpdated(el);
+ expect(el.values).to.deep.equal(['1.2'], 'should have only 1.2 as default seleted value');
+ });
+ });
+
describe('Filter Tests', function () {
it('Text filter applied, query attribute - multi level', async function () {
const el = await fixture('');
diff --git a/packages/elements/src/tree/elements/tree.ts b/packages/elements/src/tree/elements/tree.ts
index 818d2028e9..c0b729ee71 100644
--- a/packages/elements/src/tree/elements/tree.ts
+++ b/packages/elements/src/tree/elements/tree.ts
@@ -117,6 +117,10 @@ export class Tree extends List {
public override selectItem(item: T): boolean {
// Stateless tree
if (this.stateless) {
+ // Single selection - expand/collapse group (parent)
+ if (!this.multiple && this.manager.isItemParent(item)) {
+ this.toggleExpandedState(item);
+ }
return false;
}
// Multiple selection