I experience problems with the AddToAny module in the mobile environment due to the (apparently) obsoleted "FastClick" script, which is improperly highjacking click & touch events on my pages. See my issue there at https://www.drupal.org/node/2904094. It seems to be loaded by Adaptivetheme. Is there any solution for that? Thanks for helping me out Jeff.
<script src="https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>

Comments

gdelver@xs4all.nl created an issue. See original summary.

jwkovell’s picture

Assuming that the JavaScript file is not needed (I haven't checked), here's how you can remove it.

First we need to determine if the file is being added directly by your theme or if it's inherited from a base theme. You can find this out by reviewing your theme's library file (THEME_ROOT/THEME_NAME.libraries.yml).

If the file is listed there, you can just delete those lines from the library file. Clear your site's cache and you're done! If the file is not listed there, it's inherited from a base theme, and we have a few more steps.

In this case, the file in question is inherited from the at_core base theme, so we have more work to do. While you could go to at_core's library file and delete fastclick there, it's better to leave base themes alone. Instead, you can override what your theme inherits from the base theme.

Open your theme's info file (THEME_ROOT/THEME_NAME.info.yml). If you already have a section called "libraries-override", add the item(s) you want to remove there. Otherwise, create a new libraries-override section at the bottom of the file.

libraries-override:
  at_core/at.fastclick: false
  at_core/at.fastclick_initialize: false

Note
- The exact spacing used above is important. The second and third lines should be indented with exactly 2 spaces.
- For me, removing fastclick resulted in errors until I also removed fastclick_initialize. You may need to do so as well.

Save the file, clear your site's cache, and test thoroughly.

If the files really aren't needed, perhaps Jeff can remove them from the base theme. For now, though, you have control of your own theme's library files and can add or remove them as needed.

I see that fastclick also provides a way for you to ignore specific elements. If you learn that fastclick was actually needed for something else on your site, you may need to go down the route of adding the "needsclick" class to the AddToAny button.

gdelver@xs4all.nl’s picture

@jklovell, thanks for the tip. Very helpful I will give this a try!

jwkovell’s picture

It appears that fastclick.js may also have trouble with some select fields on Android phones. This cropped up on my own site just yesterday.

Rather than spend too much time figuring our why fastclick only affected some select fields and not others (it was a mix of form API, views filters and webforms forms), I just removed the fastclick.js entirely using the technique in #2.

It solved the issue with no noticeable side-effects.

gdelver@xs4all.nl’s picture

Ok, that last part is good to hear! It's now on my list of changes to do. Thanks @jklovell.

Checked it and now works fine as far as I can see...

Jeff Burnz’s picture

Assigned: Unassigned » Jeff Burnz
Category: Support request » Bug report

I'll look into it, fastclick has/had a place, its been some time since I reviewed it's use-fullness, no against removing it.

Jeff Burnz’s picture

Status: Active » Fixed

Decided to just remove it, times have changed!

Not sure why the commits are not showing up here yet, maybe soon.

  • Jeff Burnz committed a6455ed on 8.x-3.x
    Issue #2908791: Obsolete "FastClick" script loaded and getting in the...

  • Jeff Burnz committed a6455ed on 8.x-2.x
    Issue #2908791: Obsolete "FastClick" script loaded and getting in the...
Jeff Burnz’s picture

Finally, lol, there they are!

jwkovell’s picture

Indeed, they are a changin. Thanks Jeff!

Status: Fixed » Closed (fixed)

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