ScrollToElementCommand AJAX Error

Created on 9 August 2022, over 2 years ago
Updated 13 May 2024, 12 months ago

Getting this error after using Paragraphs Features in a fresh install / vanilla environment:

"
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /redacted_path/edit?ajax_form=1&_wrapper_format=drupal_ajax
StatusText: OK
ResponseText: TypeError: Drupal\paragraphs_features\Ajax\ScrollToElementCommand::__construct(): Argument #1 ($elementSelector) must be of type string, null given, called in /redacted_path/modules/contrib/paragraphs_features/src/ParagraphsFeatures.php on line 101 in Drupal\paragraphs_features\Ajax\ScrollToElementCommand->__construct() (line 36 of /redacted_path/docroot/modules/contrib/paragraphs_features/src/Ajax/ScrollToElementCommand.php)."

Symptoms:
When I try to add another component, nothing happens and the above error appears in the console.

Hack Fix?
Commenting out line 101 in /modules/contrib/paragraphs_features/src/ParagraphsFeatures.php allows me to complete my work successfully without console errors.

Line 101 in ParagraphsFeatures.php
$response->addCommand(new ScrollToElementCommand($element[$element['#max_delta']]['#attributes']['data-drupal-selector'], $element['#attributes']['data-drupal-selector']));

🐛 Bug report
Status

Needs review

Version

1.16

Component

Code

Created by

🇺🇸United States xandermar Milton, Delaware

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.

  • First commit to issue fork.
  • 🇮🇳India sahal_va

    sahal_va changed the visibility of the branch 3302712-scrolltoelementcommand-ajax-error to hidden.

  • The #5 works for me, can it alredy be merged pls?

  • 🇺🇸United States douggreen Winchester, VA

    I've seen this warning in my logs but I'm having a hard time finding a test case, and I haven't seen it recently. I think that this patch is just hiding an underlying problem, which is that either that #max_delta is wrong, or that the element that #max_delta points to wasn't added. Can anyone reproduce this still? Is it possible that this was a problem in core that has since been fixed?

Production build 0.71.5 2024