Refactor Neo.manager.Component.getParentPath to implement "Logical Component Bubbling".
Current Behavior:
getParentPath returns a strictly filtered list of registered component IDs found in the provided DOM path. It does not traverse the logical component hierarchy (e.g., component.parent or parentComponent). This causes event bubbling to fail when the DOM hierarchy is disconnected from the logical hierarchy, such as with Portals, DragProxies, or Multi-Window applications.
Proposed Change:
Update getParentPath to traverse the logical component tree once a registered component entry point is found in the DOM path.
- Iterate the DOM path until the first registered component is found.
- Switch to traversing the
component.parent chain (which honors parentComponent config).
- Return this logical path.
Advantages:
- Portals & Proxies: Enables correct event bubbling for components that are physically detached in the DOM (e.g., appended to
document.body) but logically belong to a specific view hierarchy (e.g., a Modal Dialog belonging to a UserModule, or a DragProxy belonging to a Dashboard).
- Multi-Window Support: Allows events to bubble "logically" across browser windows if a component in a child window declares a parent in the main window.
- Consistency: Aligns Neo.mjs event bubbling with modern UI patterns where "Portal" content behaves as if it were inline.
Edge Cases & Risks Considered:
- "Escaping" Events: Events from a detached dialog will now bubble to the logical parent (e.g., the Module view). Listeners on the Module view (like a generic click handler) will receive these events. This is generally desired behavior (consistent with inline dialogs) but requires developer awareness.
- DOM Path Dropping: By switching to the logical tree after the first match, we effectively drop the remainder of the raw DOM path (e.g., wrapper divs,
document.body).
- Risk: Listeners relying on
delegate selectors matching these dropped nodes.
- Mitigation:
DomEvent.verifyDelegationPath uses the full, raw DOM path passed from the main thread, not the filtered component path. Therefore, delegation logic remains robust and unaffected.
- Infinite Loops: The implementation includes a check (
!componentPath.includes(parent.id)) to prevent infinite recursion in case of circular parent references.
This change fundamentally improves the framework's ability to handle complex, detached UI architectures while maintaining backward compatibility for standard hierarchies.
Refactor
Neo.manager.Component.getParentPathto implement "Logical Component Bubbling".Current Behavior:
getParentPathreturns a strictly filtered list of registered component IDs found in the provided DOM path. It does not traverse the logical component hierarchy (e.g.,component.parentorparentComponent). This causes event bubbling to fail when the DOM hierarchy is disconnected from the logical hierarchy, such as with Portals, DragProxies, or Multi-Window applications.Proposed Change: Update
getParentPathto traverse the logical component tree once a registered component entry point is found in the DOM path.component.parentchain (which honorsparentComponentconfig).Advantages:
document.body) but logically belong to a specific view hierarchy (e.g., a Modal Dialog belonging to a UserModule, or a DragProxy belonging to a Dashboard).Edge Cases & Risks Considered:
document.body).delegateselectors matching these dropped nodes.DomEvent.verifyDelegationPathuses the full, raw DOM path passed from the main thread, not the filtered component path. Therefore, delegation logic remains robust and unaffected.!componentPath.includes(parent.id)) to prevent infinite recursion in case of circular parent references.This change fundamentally improves the framework's ability to handle complex, detached UI architectures while maintaining backward compatibility for standard hierarchies.