Problem/Motivation
When the "Enable Back To Top" checkbox is unchecked, there is a JavaScript error
Steps to reproduce
Uncheck the "Enable Back to Top" checkbox in the "Back to Top Button" tab of the theme settings.
Refresh the front page.
Proposed resolution
Add code to check the result of const scrollPath = document.querySelector(".scroll-up path"); on line 125 of main.js
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | indentation.PNG | 31 KB | angel_devoeted |
| #5 | error.PNG | 7.21 KB | angel_devoeted |
Issue fork aspiration-3590048
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
shamir.vs commentedI have created a merge request to address JS issue. Please take a moment to review it. Thank you!
Comment #5
angel_devoeted commentedHi @shamir.vs, thanks for the work on this!
I tested the MR locally and it works as expected. The
if (scrollPath)check successfully prevents thenullpointer error when the "Back to Top" button is disabled. Also, convertingFALSEtofalsewas definitely necessary as it was previously triggering aReferenceError: FALSE is not defined.One minor thing to fix. The indentation inside the new
ifblock is currently using tabs.It should be updated to use the standard 2-space indentation to follow Drupal coding standards.
Comment #7
sujan shrestha commentedThanks for the fix @gramie @shamir.vs and for the review @angel_devoeted! I have merged the changes. Setting to fixed.