feat: Add areaAsSubNode param for Area#660
Conversation
🦜 Chachalog
|
There was a problem hiding this comment.
Pull request overview
Adds support for an areaAsSubNode parameter on the React Area component so areas can be stored under the component node (useful for repeatable components), and introduces E2E coverage for the new behavior.
Changes:
- Add
areaAsSubNodeprop toAreaand forward it to the server render call. - Allow
areaAsSubNodeas a permitted attribute in the Java render helper for areas. - Extend the test component and add a Cypress E2E suite to validate rendering and node placement/isolation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/cypress/e2e/ui/areaAsSubNodeTest.cy.ts | New E2E coverage for rendering + content isolation/node structure when using areaAsSubNode. |
| javascript-modules-library/src/components/Area.tsx | Introduces areaAsSubNode prop and forwards it to server.render.renderArea. |
| javascript-modules-engine-java/.../RenderHelper.java | Adds areaAsSubNode to the allowed attribute whitelist for renderArea. |
| jahia-test-module/.../TestAreas.tsx | Adds UI fixtures (two Areas) to exercise areaAsSubNode true/false in tests. |
a0cabf0 to
58bbcdc
Compare
58bbcdc to
bca19bf
Compare
|
Note that there is an issue rendering This PR fix and cypress tests has been tested as working on 8.2.2.1 env. |
…ript-modules#660) Depends on javascript-modules-library 1.3.0-SNAPSHOT (local build). package.json updated to file: reference — repoint to released version once Jahia/javascript-modules#660 is merged and published. Areas updated with areaAsSubNode=true: - Grid: column areas (matches 2_X JSP behaviour) - Card: cardFooter (matches 2_X JSP behaviour) - Accordion: panels (accordions) and content (accordion-item, accordion-item-content) - Carousel: slides - Tabs: tabs - Button: modal-body, collapse-body, offcanvas-body CND updates (allow jnt:contentList sub-node): - bootstrap5nt:accordions: + panels (jnt:contentList) - bootstrap5nt:carousel: + slides (jnt:contentList) List: removed edit-mode <Area name="content"> drop zone to prevent jnt:contentList render loop triggered by areaAsSubNode areas elsewhere. Card content area intentionally left without areaAsSubNode: content is stored as direct children of the card node (identical to 2_X JSP), preserving migration compatibility.
|
Fix for https://github.com/Jahia/jahia-private/issues/4888 has been merge and added tests for this PR is now passing. |
There was a problem hiding this comment.
Pull request overview
This PR exposes the areaAsSubNode flag on the React <Area /> component so area content can be stored under each component instance (instead of being shared under the page), aligning the JS modules behavior with Jahia’s existing AreaTag capability.
Changes:
- Added
areaAsSubNodeprop tojavascript-modules-library’s<Area />and forwarded it to server-side rendering. - Whitelisted
areaAsSubNodein the Java engineRenderHelperattribute validation forrenderArea. - Added a test component view + Cypress e2e coverage and a changelog entry.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/cypress/e2e/ui/areaAsSubNodeTest.cy.ts |
Adds e2e checks for rendering and node creation paths for areas with/without areaAsSubNode. |
javascript-modules-library/src/components/Area.tsx |
Introduces the areaAsSubNode prop and passes it to server.render.renderArea. |
javascript-modules-engine-java/src/main/java/.../RenderHelper.java |
Allows areaAsSubNode through the renderArea attribute whitelist. |
jahia-test-module/src/react/server/views/testAreas/TestAreas.tsx |
Adds two rendered Areas to exercise areaAsSubNode=true/false in the test module. |
.chachalog/bnO8G4QV.md |
Documents the addition as a minor change in javascript-modules. |
|
From slack:
That's a shame, reading https://github.com/Jahia/jahia-private/issues/4894 it seems it is implemented as a hardcoded However, the proposed API
I don't understand these arguments, I never experienced any of these issues |
|
Thank you for the context. Will check with Philippe to understand why AbsoluteArea does not work when it should be the same as Also from David's comment:
|
Description
Expose
areaAsSubNodeparam for Area template that is available in theAreaTagjsp template https://github.com/Jahia/jahia-private/blob/master/taglib/src/main/java/org/jahia/taglibs/template/include/AreaTag.java#L113This allow areas to be distinctly defined within (multiple) declared component when
areaAsSubNodeis set to true, rather than shared under current page.Checklist
Source code
Tests
Tip
Documentation to guide the reviews: How to do a code review