Skip to content

feat: Add areaAsSubNode param for Area#660

Open
gflores-jahia wants to merge 4 commits into
mainfrom
4894-add-area-subnode-param
Open

feat: Add areaAsSubNode param for Area#660
gflores-jahia wants to merge 4 commits into
mainfrom
4894-add-area-subnode-param

Conversation

@gflores-jahia
Copy link
Copy Markdown
Member

@gflores-jahia gflores-jahia commented Apr 15, 2026

Description

Expose areaAsSubNode param for Area template that is available in the AreaTag jsp template https://github.com/Jahia/jahia-private/blob/master/taglib/src/main/java/org/jahia/taglibs/template/include/AreaTag.java#L113

This allow areas to be distinctly defined within (multiple) declared component when areaAsSubNode is set to true, rather than shared under current page.

Checklist

Source code

  • I've shared and documented any breaking change
  • I've reviewed and updated the jahia-depends

Tests

  • I've provided Unit and/or Integration Tests
  • I've updated the parent issue with required manual validations

Tip

Documentation to guide the reviews: How to do a code review

Copilot AI review requested due to automatic review settings April 15, 2026 21:21
@gflores-jahia gflores-jahia requested a review from a team as a code owner April 15, 2026 21:21
@gflores-jahia gflores-jahia marked this pull request as draft April 15, 2026 21:22
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 15, 2026

🦜 Chachalog

javascript-modules minor

Create a new entry online or run npx chachalog@0.5.0 prompt to create a new entry locally.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 areaAsSubNode prop to Area and forward it to the server render call.
  • Allow areaAsSubNode as 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.

Comment thread tests/cypress/e2e/ui/areaAsSubNodeTest.cy.ts Outdated
Comment thread tests/cypress/e2e/ui/areaAsSubNodeTest.cy.ts Outdated
@gflores-jahia gflores-jahia force-pushed the 4894-add-area-subnode-param branch from a0cabf0 to 58bbcdc Compare April 15, 2026 21:36
@gflores-jahia gflores-jahia force-pushed the 4894-add-area-subnode-param branch from 58bbcdc to bca19bf Compare April 16, 2026 22:50
@gflores-jahia
Copy link
Copy Markdown
Member Author

gflores-jahia commented Apr 16, 2026

Note that there is an issue rendering areaAsSubNode in this story https://github.com/Jahia/jahia-private/issues/4888, so will need to wait for that before merging this in. Update: This has been recently merged and should be available in latest 8.2.4-SN.

This PR fix and cypress tests has been tested as working on 8.2.2.1 env.

pvollenweider added a commit to Jahia/bootstrap5 that referenced this pull request Apr 17, 2026
…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.
@gflores-jahia gflores-jahia marked this pull request as ready for review April 21, 2026 20:22
@gflores-jahia
Copy link
Copy Markdown
Member Author

Fix for https://github.com/Jahia/jahia-private/issues/4888 has been merge and added tests for this PR is now passing.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 areaAsSubNode prop to javascript-modules-library’s <Area /> and forwarded it to server-side rendering.
  • Whitelisted areaAsSubNode in the Java engine RenderHelper attribute validation for renderArea.
  • 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.

Comment thread javascript-modules-library/src/components/Area.tsx
Comment thread tests/cypress/e2e/ui/areaAsSubNodeTest.cy.ts
Comment thread .chachalog/bnO8G4QV.md Outdated
@GauBen
Copy link
Copy Markdown
Member

GauBen commented Apr 27, 2026

From slack:

We intentionally removed areaAsSubNode during the beta of JS modules because one of the two values (IIRC areaAsSubNode={false}) does not make sense and we should be using <AbsoluteArea> instead (which does that and more)

That's a shame, reading https://github.com/Jahia/jahia-private/issues/4894 it seems it is implemented as a hardcoded areaAsSubNode={false}

However, the proposed API <Area name="main" parent={currentNode} /> is exactly the one of <AbsoluteArea> (i.e. you attach your area to an explicit node)

  • it unconditionally enables page-inheritance regardless of context
  • it requires the parent node to already exist in the JCR
  • these are broader side-effects absent from JSP's areaAsSubNode

I don't understand these arguments, I never experienced any of these issues

@gflores-jahia
Copy link
Copy Markdown
Member Author

gflores-jahia commented Apr 27, 2026

Thank you for the context. Will check with Philippe to understand why AbsoluteArea does not work when it should be the same as <Area name="main" parent={currentNode} />

Also from David's comment:

FYI areaAsSubNode has been introduce to fix a bug/flaw related to area names, ensure we don't reintroduce it https://support.jahia.com/browse/SOC-121

@gflores-jahia gflores-jahia removed the request for review from a team April 28, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants