Scrollup link is being added multiple times when using the Admin Toolbar

Created on 26 January 2022, over 2 years ago
Updated 22 January 2023, over 1 year ago

Problem/Motivation

As admin when using the Admin Toolbar menu, I've noticed that the link piece of HTML appears 4 times:
<a href="#" title="scroll_title" class="scrollup">Scroll<div class="scroll-title"></div></a>

The multiple links are not visible, they appear to be a single one, because they are positioned on top of each other. This makes this issue not really urgent.

Steps to reproduce

# Enable Scrollup and Admin toolbar
# Login as admin
# Check in the source HTML of a page having the scrollup button.

Proposed resolution

I suggest to change the javascipt in scrollup_top.js from this:
$('body').append('<a href="#" title="scroll_title" class="scrollup">Scroll<div class="scroll-title">'+scroll_title+'</div></a>');
... to this:
$('body').once().append('<a href="#" title="scroll_title" class="scrollup">Scroll<div class="scroll-title">'+scroll_title+'</div></a>');

So, it's just to add the once() method to the chain.

When doing this, we'll also need to add a dependency for `core/jquery.once` in the library declaration.

Remaining tasks

  1. Discuss and decide;
  2. Do it, if agreed.
πŸ“Œ Task
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡΅πŸ‡ΉPortugal dxvargas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024