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

CommentFileSizeAuthor
#5 indentation.PNG31 KBangel_devoeted
#5 error.PNG7.21 KBangel_devoeted

Issue fork aspiration-3590048

Command icon 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

gramie created an issue. See original summary.

shamir.vs made their first commit to this issue’s fork.

shamir.vs’s picture

Status: Active » Needs review

I have created a merge request to address JS issue. Please take a moment to review it. Thank you!

angel_devoeted’s picture

StatusFileSize
new7.21 KB
new31 KB

Hi @shamir.vs, thanks for the work on this!

I tested the MR locally and it works as expected. The if (scrollPath) check successfully prevents the null pointer error when the "Back to Top" button is disabled. Also, converting FALSE to false was definitely necessary as it was previously triggering a ReferenceError: FALSE is not defined.

error

One minor thing to fix. The indentation inside the new if block is currently using tabs.
It should be updated to use the standard 2-space indentation to follow Drupal coding standards.

indentation

sujan shrestha’s picture

Version: 1.1.4 » 1.1.5
Status: Needs review » Fixed

Thanks for the fix @gramie @shamir.vs and for the review @angel_devoeted! I have merged the changes. Setting to fixed.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.