Help scroll top#33742
Conversation
removed two local html files from system
|
I have tested this item ✅ successfully on 5348ac5 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/33742. |
| $wa = $this->document->getWebAssetManager(); | ||
|
|
||
| $wa->addInlineScript(" | ||
| document.addEventListener('DOMContentLoaded', function(event) { |
| element.addEventListener('click', event => { | ||
| window.scroll(0,0); | ||
| }); | ||
| }) |
There was a problem hiding this comment.
You can simplify it, to:
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
const helpIndex = document.getElementById('help-index');
if (helpIndex) {
[].slice.call(helpIndex.querySelectorAll('a'))
.map((element) => element.addEventListener('click', () => { window.scroll(0,0); }));
}That's all the content of the file you need
|
So I moved the javascript to a file and am now looking at the build errors - not ready to retest. |
@ceford just use the snippet from #33742 (comment) should be CI friendly |
|
@dgrammatiko Thanks for the snippet - used that and now waiting for the checks to finish. |
You need an empty line at the end |
|
one more change |
|
I have tested this item ✅ successfully on 05bad1f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/33742. |
|
I have tested this item ✅ successfully on 05bad1f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/33742. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/33742. |
Pull Request for Issue #33722 .
Summary of Changes
Added Javascript to scroll window to top on selection of Help page
Testing Instructions
Go to Administrator / Help / Start Here - Joomla! Help
Scroll down to near the bottom of the long list and click an item there
Apply patch and rebuild with npm ci
Actual result BEFORE applying this Pull Request
Something should happen, but
Nothing appears to happen because the Iframe with the new help page has been loaded out of sight.
Expected result AFTER applying this Pull Request
The page will scroll to top bringing the newly loaded Help page into view.
Documentation Changes Required
None