Although I see it was decided not to add an admin/config page for this module in #2214151: Provide admin config for disabling init code, I'd like to request that and admin/config page be added that allows the FastClick code to be disabled by content type (or possibly even path). I'm finding that this module prevents the Closed Question module from working correctly (clicking on the "Submit" button for questions does not work when FastClick is enabled). Thus, it would be great if I could disable the script from initializing on that content type.

On the other hand, it is quite possible that addressing the AJAX issue at #2217069: Automatically add 'needsclick' class to Drupal generated AJAX elements would also resolve this problem for me, negating the need for an admin/config page.

Comments

rupl’s picture

In general I would recommend against "drupal-level" configuration for this module. There are many global elements on your page that still benefit from FastClick, so disabling it on an entire page due to its content means that other parts of the page will be hurt. For example your menus will feel fast on all pages except one content type, which will probably be perceived by your users as a bug.

I think a better solution is to add the needsclick class to the elements that have problems. I will investigate the options for adding the class (can you add to the DOM or does it have to be markup?).

Overall it sounds like some additional docs are needed, rather than coding exceptions for every module.

Pere Orga’s picture

Yes I agree. Also, you should be able to add the needsclick class in the body of the pages that you don't want it enabled.

Another, cleaner option is to manually disable adding the library on every page, and manually add it yourself. You could also do the opposite, attach the behaviour only when the body has the fastlclick class:

FastClick.attach(document.body, '.fastclick');

(and preprocessing the pages to add fastclick when needed.

spazfox’s picture

Status: Active » Closed (works as designed)

Thanks. Adding the needsclick class to the article tag in my template file for closed questions seems to have done the trick.

spazfox’s picture

Status: Closed (works as designed) » Active

Actually, after further testing I've discovered that adding the needsclick class to the article tag for closed question content still results in problems (on the iPad at least). Does needsclick need to be added to every single element on a page that needs to be excluded from the Fastclick behavior? If so, then I would stand by my request that an admin UI for disabling by content type be included (I have hundreds of closed questions on my site and it would be ridiculous to attempt to identify every single element of each that needs the needsclick class added to it). Despite how cool it is, in its current form this module is virtually unusable on my site.

rupl’s picture

Adding a per content type control is not going to happen. It's not a logical option. You're absolutely welcome to think of a different solution and mention it here.

How did you add the class? in the markup? In the DOM via jQuery? That might be the issue. Can you post an example link? There are lots of ways to provide more information so we can try to resolve the issue within Closed Question. Did you try Pere's solution in comment #2? I see this theme.inc file in the repo, could we investigate adding the needsclick class there, with the code wrapped in a module_exists('fastclick') statement?

While I respect that this is causing you frustration, the real problem probably lies within the Closed Question module, not this one. We should fix broken modules instead of adding complexity to simple modules. FastClick works pretty much everywhere, including thousands of non-Drupal sites.

I'd recommend you uninstall FastClick temporarily if it's breaking your site. It's not offering required functionality of any sort, just an enhancement to UX.