Skip to content

[5.4] Check if page title element exists in table column script#46776

Merged
muhme merged 2 commits intojoomla:5.4-devfrom
Digital-Peak:table
Feb 5, 2026
Merged

[5.4] Check if page title element exists in table column script#46776
muhme merged 2 commits intojoomla:5.4-devfrom
Digital-Peak:table

Conversation

@laoneo
Copy link
Copy Markdown
Member

@laoneo laoneo commented Jan 30, 2026

Summary of Changes

When opening a back end list with tmpl=component parameter there is a javascript error for a missing element.

Testing Instructions

Open in the back end the url /administrator/index.php?option=com_content&view=articles&tmpl=component.

Actual result BEFORE applying this Pull Request

Javascript error:
can't access property "textContent", document.querySelector(...) is null

Expected result AFTER applying this Pull Request

No Javascript error.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.4-dev labels Jan 30, 2026
@laoneo laoneo added the bug label Jan 30, 2026
@brianteeman
Copy link
Copy Markdown
Contributor

brianteeman commented Jan 30, 2026

This PR fixes the console error but i am not sure it is enough. Both with and without this PR the table column selector is not loaded when it should be. This means that if you have used the table column selector to decide which columns are displayed then it is ignored when the tmpl=component is used

@laoneo
Copy link
Copy Markdown
Member Author

laoneo commented Jan 30, 2026

Not sure what to do then in the case when no table name is set and no page title is defined. Adding the name attribute to the tables is out of this scope for this pr.

@brianteeman
Copy link
Copy Markdown
Contributor

For me the bug is not the console error but the fact that the table column script will not run in this view

@laoneo
Copy link
Copy Markdown
Member Author

laoneo commented Jan 30, 2026

Thanks for sharing your opinion.

@brianteeman
Copy link
Copy Markdown
Contributor

pretty sure we already have a pr that would address the situation where the page does not have a title

@laoneo
Copy link
Copy Markdown
Member Author

laoneo commented Jan 30, 2026

I couldn't find one.

@laoneo laoneo added the PBF Pizza, Bugs and Fun label Jan 30, 2026
@465645
Copy link
Copy Markdown

465645 commented Jan 31, 2026

I have tested this item ✅ successfully on 21c8e72

C:\xampp\htdocs\joomlapbf\test_table_columns.html
Fixed a null reference error that occurred when opening backend lists with tmpl=component parameter, where the .page-title element doesn't exist. The main part fixed is:-
const tableName = $table.dataset.name
|| document.querySelector('.page-title')?.textContent?.trim()?.replace(/[^a-z0-9]/gi, '-')?.toLowerCase();


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46776.

@dautrich
Copy link
Copy Markdown

dautrich commented Feb 5, 2026

I have tested this item ✅ successfully on 21c8e72


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46776.

@richard67
Copy link
Copy Markdown
Member

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46776.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Feb 5, 2026
@muhme
Copy link
Copy Markdown
Contributor

muhme commented Feb 5, 2026

✅ Final test before merge using JBT

  • Before PR seen Uncaught TypeError: can't access property "textContent", document.querySelector(...) is null
  • Applied PR with Patch Tester and npm run build:js
  • No JS error anymore, list is generated

@muhme muhme merged commit 2d03b35 into joomla:5.4-dev Feb 5, 2026
69 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Feb 5, 2026
@muhme muhme removed the PBF Pizza, Bugs and Fun label Feb 5, 2026
@muhme muhme added this to the Joomla! 5.4.3 milestone Feb 5, 2026
@muhme
Copy link
Copy Markdown
Contributor

muhme commented Feb 5, 2026

Thank you @laoneo for your contribution. Thank you @brianteeman for support. Thank you @465645 and @dautrich for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.4-dev

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants