Problem/Motivation

If you add 47 or more blocks in different regions on the Block Layout page, then you try to drag any block to a different region, you will get the following javascript error in the console:

Cannot read properties of undefined (reading 'className')
File: block.js?v=9.2.6:106

Proposed resolution

I noticed that if you have 46 or less blocks then the weight fields in the layout page are 'select' elements, and this is what the block.js looks for. But when you have 47 or more blocks then the weight fields are input elements and hence the JS cannot find them. The JS needs to look for input elements too.

Comments

hga77 created an issue. See original summary.

harcher’s picture

Issue summary: View changes
cilefen’s picture

Issue tags: +JavaScript
nod_’s picture

Version: 9.2.x-dev » 9.4.x-dev

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

tom konda’s picture

Issue tags: -JavaScript +JavaScript

I cannot reproduce this issue on the 11.x branch.

Steps to try to reproducing

  1. Install Drupal with standard profile
  2. Install custom theme which contains content region and 49 regions (See below)
  3. Create 36 block content
  4. Configure each region has only one block
  5. Move a block to another region
  6. No error occurs
  7. All of blocks move to specific region
  8. Move a block to another region
  9. No error occurs

custom_theme.info.yml

name: Region Test
type: theme
description: https://www.drupal.org/project/drupal/issues/3249296
'base theme': stable9
core_version_requirement: ^11
regions:
  region01: Region 01
  region02: Region 02
  region03: Region 03
  region04: Region 04
  region05: Region 05
  region06: Region 06
  region07: Region 07
  region08: Region 08
  region09: Region 09
  region10: Region 10
  region11: Region 11
  region12: Region 12
  region13: Region 13
  region14: Region 14
  region15: Region 15
  region16: Region 16
  region17: Region 17
  region18: Region 18
  region19: Region 19
  region20: Region 20
  region21: Region 21
  region22: Region 22
  region23: Region 23
  region24: Region 24
  region25: Region 25
  region26: Region 26
  region27: Region 27
  region28: Region 28
  region29: Region 29
  region30: Region 30
  region31: Region 31
  region32: Region 32
  region33: Region 33
  region34: Region 34
  region35: Region 35
  region36: Region 36
  region37: Region 37
  region38: Region 38
  region39: Region 39
  region40: Region 40
  region41: Region 41
  region42: Region 42
  region43: Region 43
  region44: Region 44
  region45: Region 45
  region46: Region 46
  region47: Region 47
  region48: Region 48
  region49: Region 49
  content: Content

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.