Uncaught TypeError: Cannot read template_entity_form__template_load.js?v1.x:70 properties of undefined (reading 'top')

Created on 12 February 2023, about 2 years ago
Updated 14 February 2023, about 2 years ago

Problem/Motivation

With the Claro theme, when a user clicks on the 'Insert' button on the TwigTemplateForm form, the template code is inserted; however, the page does not scroll upward. The following error is logged in console:

Uncaught TypeError: Cannot read template_entity_form__template_load.js?v1.x:70 properties of undefined (reading 'top')

Beginning in Claro, Drupal changed the class for the item from form-item-template-code to form-item--template-code.

From Drupal 9.5.x:

% grep -R -- "'form-item-' ~ name|clean_class" 
./core/profiles/demo_umami/themes/umami/templates/classy/form/form-element.html.twig:    'form-item-' ~ name|clean_class,
./core/modules/system/templates/form-element.html.twig:    'form-item-' ~ name|clean_class,
./core/themes/stable/templates/form/form-element.html.twig:    'form-item-' ~ name|clean_class,
./core/themes/stable9/templates/form/form-element.html.twig:    'form-item-' ~ name|clean_class,
./core/themes/bartik/templates/classy/form/form-element.html.twig:    'form-item-' ~ name|clean_class,
./core/themes/classy/templates/form/form-element.html.twig:    'form-item-' ~ name|clean_class,
./core/themes/seven/templates/classy/form/form-element.html.twig:    'form-item-' ~ name|clean_class,
./core/themes/starterkit_theme/templates/form/form-element.html.twig:    'form-item-' ~ name|clean_class,
% grep -R -- "'form-item--' ~ name|clean_class"
./core/themes/claro/templates/form-element.html.twig:    'form-item--' ~ name|clean_class,

Proposed resolution

Add a custom class to the form item, and target it with JS instead.

Remaining tasks

  • Write Patch
  • Add test coverage

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Chris Burge

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

Comments & Activities

Production build 0.71.5 2024