User tests: Successful: Unsuccessful:
Pull Request for Issue #45770 (the limit box; the sort headings are #48523).
With the Nonce option of the System - HTTP Headers plugin enabled, browsers ignore 'unsafe-inline' and block inline event handlers. Some list controls still rely on them:
Grid::checkall)layouts/joomla/pagination/link.php)Pagination::getLimitBox): this is the second half of #45770#45910 already did this for the row checkboxes (Grid::id), and #48523 does it for the frontend sort headings (Grid::sort). Following the same approach, these controls now use classes and data attributes that the list-view script handles. Each helper loads that script itself:
Grid::checkall: uses the existing js-grid-item-check-all handler. A custom $action is still rendered as an inline onclick, for b/c.Pagination::getLimitBox and Grid::state: a new js-grid-submit-on-change handler submits the select's form with Joomla.submitform(). The administrator and site branches of getLimitBox rendered the same select with a different onchange; they are now one.data-limitstart and data-limitstart-field attributes, and a new js-grid-pagination-link handler that sets limitstart and submits adminForm, as the inline code did. Site pagination links are plain links and do not change.New unit tests cover the markup of these helpers: tests/Unit/Libraries/Cms/Html/HtmlGridTest.php and tests/Unit/Libraries/Cms/Pagination/PaginationTest.php.
This PR does not touch Grid::sort and merges cleanly with #48523. It is the first of a few PRs, split by area, so that the core screens work with a nonce-based policy. The next ones cover the toolbar and shared layouts, the administrator modals and the component views.
For b/c:
Joomla.submitform(), which fires the form's submit event; form.submit() did not.list-view script, as it already does for Grid::id since #45910.getLimitBox() loads list-view, and with it core, whenever it is called. That includes getListFooter(), which hides the box by default. On administrator lists both scripts are already loaded by Grid::id.This PR changes JavaScript (media_source/system/js/list-view.es6.js), so use the prebuilt package or run npm ci after applying it.
script-src, Value 'self', Client Both. Save.With the CSP enabled:
2. No row is checked.
3. The list stays on page 1.
4. The list is not reloaded.
For each of these, the browser console reports a Content Security Policy violation for an inline event handler.
With the CSP enabled:
2. All rows are checked and the toolbar actions are enabled. The second click unchecks them.
3. Page 2 is shown.
4. The list reloads with the selected number of articles.
These controls report no Content Security Policy violation. The column sort links still report one until #48523 is merged.
With the CSP disabled, everything works as before.
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Layout Libraries JavaScript NPM Change Unit Tests |
It is the first of a few PRs, split by area, so that the core screens work with a nonce-based policy. The next ones cover the toolbar and shared layouts, the administrator modals and the component views.
Before proceeding any further with any more pull requests you really should create a feature request in the Discussions area here on github - this is especially true because there is a large piece of work that might make any changes you make surplus to requirements and I wouldnt want you to waste your time
It is also a requirement that you personally check the AI statement or this will need to be closed
Thanks @brianteeman, that makes sense. I've opened #48738 with the whole plan, so it can be discussed in one place. This PR itself fixes the limit box half of #45770, next to your #48523 for the sort headings.
You mention a larger piece of work that might overlap: could you point me to it? I'd like to line the next parts up with it rather than duplicate anything.
The one failing system test (site com_users/Mfa.cy.js, backup codes) isn't related to this change. The TOTP code for that 30-second window was 036595, but totp-generator 1.0.0 doesn't zero-pad, so the test typed 36595 and the site rightly rejected it (see the screenshot in the run's system-test-output artifact). The other system test jobs were cancelled after it failed. Could someone re-run the failed jobs?
Could someone re-run the failed jobs?
Done.
I have tested this item ✅ successfully on 927732c
I have successfully test this. Thanks @anabobillo3! (No idea how the original submitter found such a specific/complex set of bugs but happy you fixed them).
I have tested this item ✅ successfully on 927732c
I have successfully test this. Thanks @anabobillo3! (No idea how the original submitter found such a specific/complex set of bugs but happy you fixed them).
Before proceeding any further with any more pull requests you really should create a feature request in the Discussions area here on github - this is especially true because there is a large piece of work that might make any changes you make surplus to requirements and I wouldnt want you to waste your time