First ajax submit gets hijacked by search form

Created on 28 January 2024, about 1 year ago
Updated 16 July 2024, 8 months ago

Problem/Motivation

First ajax submit gets hijacked by search form in certain blocks

Steps to reproduce

Findings with OlSivero and Stark theme, placing either search form block (narrow or wide) in the primary menu.
Submitting ajax add to cart form with attributes, the first submit if there were no selections on the form doesn't use ajax.
Once you make a selection ajax works as expected.

Proposed resolution

Not sure.

Remaining tasks

TBD

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

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

Comments & Activities

  • Issue created by @tonytheferg
  • 🇫🇷France sébastien-fr Nantes - France

    Hello,

    I have a similar problem, the context is different but it seems to me to be related. When a client is not identified, the ajax modal works. When the client is identified, the modal does not work when the page loads. But if we choose a variation (change of variation in ajax), then the ajax modal works afterwards. I have no errors in the logs or in the js console. What I see is that add to cart button (.button--add-to-cart) is missing data-once="drupal-ajax" . If I add it like this it works :

    $('.button--add-to-cart').attr('data-once', 'drupal-ajax');

    It works but it's not ideal. We should see why this attribute is not added.

Production build 0.71.5 2024