Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tree): Active tree item on click #1133

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Date-time input - `inputFormat` is not applied to an already set value [#1114](https://github.com/IgniteUI/igniteui-webcomponents/issues/1114)
- Select, Dropdown - Unable to select item when clicking on a wrapping element inside the dropdown/select item slot [#1123](https://github.com/IgniteUI/igniteui-webcomponents/issues/1123)
- Tree - active state is correctly applied to the correct tree node on click [#1131](https://github.com/IgniteUI/igniteui-webcomponents/issues/1131)

## [4.8.0] - 2024-03-20
### Added
Expand Down
13 changes: 10 additions & 3 deletions src/components/tree/tree-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import IgcCheckboxComponent from '../checkbox/checkbox.js';
import { blazorSuppress } from '../common/decorators/blazorSuppress.js';
import { watch } from '../common/decorators/watch.js';
import { registerComponent } from '../common/definitions/register.js';
import { isLTR, partNameMap } from '../common/util.js';
import {
findElementFromEventPath,
isLTR,
partNameMap,
} from '../common/util.js';
import IgcIconComponent from '../icon/icon.js';
import IgcCircularProgressComponent from '../progress/circular-progress.js';

Expand Down Expand Up @@ -287,7 +291,10 @@ export default class IgcTreeItemComponent extends LitElement {
}

private itemClick(event: MouseEvent): void {
if (this.disabled) {
if (
this.disabled ||
!this.isSameNode(findElementFromEventPath(this.tagName, event)!)
) {
return;
}
this.tabIndex = 0;
Expand All @@ -298,7 +305,7 @@ export default class IgcTreeItemComponent extends LitElement {
this.expandWithEvent();
}
}
this.navService?.setFocusedAndActiveItem(this, true, false);
this.navService?.setFocusedAndActiveItem(this, true, true);
}

private expandIndicatorClick(): void {
Expand Down
Loading