Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#44965] navigation changes on the file picker modal

Eric Schubert57b6736633c4
diff --git a/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.component.ts b/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.component.ts
index 06e5db497fc..fb9a03b3c5e 100644
--- a/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.component.ts
+++ b/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.component.ts
@@ -66,4 +66,26 @@ export class StorageFileListItemComponent {
return SpotDropAlignmentOption.TopLeft;
}
+
+ /**
+ * This function enables an override of the click on the label for the storage file list items.
+ *
+ * Normal behaviour is, that the label click is associated with the first interactive element,
+ * which usually should be the checkbox if available, or the "enterDirectory" icon button,
+ * if no checkbox is available.
+ *
+ * With this override, the click on the label of a directory element WITH checkbox instead enters the directory.
+ * But if directly targeting the checkbox, the item is checked instead.
+ *
+ * (WorkPackage #44965)
+ */
+ enterDirectoryOnLabel(event:MouseEvent):void {
+ const isCheckboxTarget = (event.target as HTMLElement).className.includes('spot-checkbox');
+
+ if (this.content.isDirectory && !isCheckboxTarget) {
+ this.content.enterDirectory();
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
}
diff --git a/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.html b/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.html
index 8c3d704cf19..ff7b6f31917 100644
--- a/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.html
+++ b/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.html
@@ -12,6 +12,7 @@
slot="trigger"
class="spot-list--item-action"
data-qa-selector="op-files-picker-modal--list-item"
+ (click)="enterDirectoryOnLabel($event)"
[ngClass]="{
'spot-list--item-action_disabled': content.disabled,
'op-file-list--item-action_view-not-allowed': content.isConstrained