NPM Resource Changed PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar devesht-ML
devesht-ML
28 Apr 2026

Pull Request resolves #47587

  • I read the Generative AI policy and my contribution is compatible with GNU/GPL 2 or later.

Summary of Changes

Fix unbalanced HTML caused by splitting content at the readmore tag in the Content table bind() method.

When an HTML element (e.g. <div>) spans across the readmore boundary, the current implementation uses preg_split() which results in:

  • unclosed tags in introtext
  • closing tags in fulltext

This leads to invalid DOM structure and can cause nested .blog-item elements and layout issues in blog/featured views.

This patch ensures that both introtext and fulltext are balanced after splitting.


Testing Instructions

  1. Create a new article
  2. Click Toggle Editor (code view)
  3. Paste the following HTML:
<div class="test-wrapper">
Intro content before readmore

<hr id="system-readmore">

Full content after readmore
</div>
  1. Save the article and mark it as Featured

  2. Create 2–3 similar articles

  3. Create a menu item of type Featured Articles

  4. Set:

    • Leading Articles = 0
    • Intro Articles = 3
    • Columns = 2 or 3
  5. Open the frontend page and inspect .blog-item elements


Actual result BEFORE applying this Pull Request

  • introtext contains unclosed HTML tags
  • Browser auto-corrects DOM
  • .blog-item elements become nested
  • Layout breaks (stacked or inconsistent grid)

Expected result AFTER applying this Pull Request

  • HTML structure remains valid after readmore split
  • .blog-item elements are rendered as siblings
  • No DOM nesting issues
  • Layout behaves correctly according to column configuration

Screenshots

Before Fix (nested structure / broken layout):

article_console

After Fix (correct DOM structure):

MixCollage-28-Apr-2026-12-38-PM-6049

Link to documentations

  • No documentation changes for guide.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar devesht-ML devesht-ML - open - 28 Apr 2026
avatar devesht-ML devesht-ML - change - 28 Apr 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Apr 2026
Category Front End com_content Libraries NPM Change
avatar devesht-ML devesht-ML - change - 28 Apr 2026
The description was changed
avatar devesht-ML devesht-ML - edited - 28 Apr 2026
avatar devesht-ML devesht-ML - change - 28 Apr 2026
Labels Added: NPM Resource Changed PR-5.4-dev
avatar joomla-cms-bot joomla-cms-bot - change - 28 Apr 2026
Category Front End com_content Libraries NPM Change Front End com_content Libraries
avatar devesht-ML
devesht-ML - comment - 28 Apr 2026

Additional Notes

During testing, it may appear that articles are displayed unevenly (for example, two items in the first row and one item below). This is expected behavior based on Joomla’s blog layout configuration.

The number of columns determines how many items are displayed per row. When the total number of articles is not evenly divisible by the column count, the remaining items naturally flow into the next row. For example, with 3 articles and 2 columns, the layout will show 2 items in the first row and 1 item in the second row.

This behavior is unrelated to the reported issue.


Implementation Details

While investigating the problem, I initially explored applying a fix at the template level (default_item.php) by adjusting how introtext is rendered. Although this resolved the issue locally, it only acted as a presentation-layer workaround and did not address the root cause.

The actual issue originates earlier during the readmore split in the Content table bind() method. When preg_split() is used, it can produce unbalanced HTML if an element spans across the readmore boundary.

For this reason, the fix has been implemented in:

libraries/src/Table/Content.php

This ensures that the HTML is corrected at the data-processing stage, making the solution consistent across all views rather than limited to a specific template.

avatar brianteeman
brianteeman - comment - 28 Apr 2026

I agree that the fix should be in the library where the content is actually split but this PR also includes changes at the template layer

avatar devesht-ML devesht-ML - change - 28 Apr 2026
Labels Removed: NPM Resource Changed
avatar joomla-cms-bot joomla-cms-bot - change - 28 Apr 2026
Category Front End com_content Libraries Front End com_content Libraries NPM Change
avatar devesht-ML devesht-ML - change - 28 Apr 2026
Labels Added: NPM Resource Changed
avatar devesht-ML
devesht-ML - comment - 28 Apr 2026

Thank you for the review and for pointing that out.

I have now removed the unintended template-level changes from default_item.php and ensured that the fix is limited strictly to the content processing layer.

I’ve also updated the implementation to handle a broader set of block-level elements, as suggested, to make the solution more robust.

Please let me know if any further adjustments are needed.

avatar joomla-cms-bot joomla-cms-bot - change - 29 Apr 2026
Category Front End com_content Libraries NPM Change Libraries NPM Change
avatar joomla-cms-bot joomla-cms-bot - change - 29 Apr 2026
Category Libraries NPM Change Libraries
avatar devesht-ML devesht-ML - change - 29 Apr 2026
Labels Removed: NPM Resource Changed
avatar joomla-cms-bot joomla-cms-bot - change - 29 Apr 2026
Category Libraries Libraries NPM Change
avatar rdeutz rdeutz - close - 6 May 2026
avatar rdeutz
rdeutz - comment - 6 May 2026

Thanks for the PR, Unfortunately, this is not a propper solution for the problem. It is also not a big problem because TinyMCE fixes some of the situations.

avatar rdeutz rdeutz - change - 6 May 2026
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2026-05-06 17:48:38
Closed_By rdeutz
Labels Added: NPM Resource Changed

Add a Comment

Login with GitHub to post a comment