Skip to content

Commit e37e60f

Browse files
committed
Add JSDoc to UiStateLinkBuilder.build() explaining href vs data-attribute contract
1 parent 81704bb commit e37e60f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

frontend/src/app/features/work-packages/components/wp-fast-table/builders/ui-state-link-builder.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ export class UiStateLinkBuilder {
2424
return this.build(workPackageId, 'show', title, content, routingId);
2525
}
2626

27+
/**
28+
* Build an anchor element that serves two purposes:
29+
*
30+
* - **href** uses `routingId` (semantic, e.g. "PROJ-7") so the URL bar
31+
* and "open in new tab" show human-readable identifiers.
32+
* - **data-work-package-id** always uses the numeric `workPackageId` (PK)
33+
* because the selection, focus, and hover systems are keyed by PK.
34+
*
35+
* Click handlers (WorkPackageStateLinksHandler) read the data attribute
36+
* and call preventDefault() — the href is never followed during normal
37+
* in-table clicks. It only matters for right-click / open-in-new-tab.
38+
*/
2739
private build(workPackageId:string, state:'show'|'split', title:string, content:string, routingId?:string) {
2840
const a = document.createElement('a');
2941
const idForHref = routingId ?? workPackageId;

0 commit comments

Comments
 (0)