Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After filing this issue #610068: Document AJAX no-js and use-ajax about not understanding how to use the 'use-ajax' class and hacking away trying to figure it out, I finally chatted with merlinofchaos in irc and he explained how it was supposed to work but it was still missing a small piece. Just need to set the event type for links to 'click'.
Attached is a one-line patch.
Comment | File | Size | Author |
---|---|---|---|
#3 | ajax_links_615504_01.patch | 433 bytes | rfay |
ajax_links.patch | 812 bytes | katbailey | |
Comments
Comment #1
rfaysubscribing and will review
Comment #2
rfayI confirm that this works, and thank you for your example code. It also does not break any of the simple examples in the ajax_example in the Examples module.
However, you say "Just need to set the event type for links to 'click'."
But the patch actually sets the event type for all elements with the class, doesn't it? Might there not be some repercussions of this?
Comment #3
rfayOK, I took a closer look. element_settings only gets used by the href.
I think perhaps this minor change is clearer about the intent. Patch attached. Still a one-line patch. Does the exact same thing. Moved to a more specific location.
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedYes, I think I didn't realize that the event in use for links would be wrong. This fixes it to the proper event.
Comment #5
webchickCommitted to HEAD. Thanks!