Problem/Motivation

On the content language and translation page, you can get multiple, repeated JavaScript errors that start with:

Uncaught TypeError: Cannot read properties of undefined (reading 'matches')...

This seems to be related to code that handles "columns" on this particular page. I haven't seen the columns in question. They may only show up when certain modules are added and/or enabled, or it may be something that is being implemented in Drupal 11.

This issue was introduced in #3238849: Refactor (if feasible) use of jquery is function to use vanillaJS
and a similar issue is being worked on in #3410011: contentTranslationDependentOptions behavior doesn't check if found element array is empty

Steps to reproduce

  1. Enable the content translation module on a site with a few content types, taxonomies, etc.
  2. Navigate to the content language and translation page (/admin/config/regional/content-language)

Proposed resolution

We just need to check if the variable is not empty before trying to run the regex on it.

https://git.drupalcode.org/project/drupal/-/merge_requests/6276

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3416304

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

RoloDMonkey created an issue. See original summary.

rolodmonkey’s picture

Issue summary: View changes

rolodmonkey’s picture

Issue summary: View changes
rolodmonkey’s picture

Title: Javascript Warning from Content Language and Translation Page » Javascript warning from content language and translation page
rolodmonkey’s picture

rolodmonkey’s picture

Status: Active » Needs review
smustgrave’s picture

Version: 10.2.x-dev » 11.x-dev
Status: Needs review » Needs work

Have not tested but MR appears to have failures. Is the issue fixed in #3410011: contentTranslationDependentOptions behavior doesn't check if found element array is empty ? May need test coverage.

rolodmonkey’s picture

As far as I can tell, this issue is not fixed by #3410011: contentTranslationDependentOptions behavior doesn't check if found element array is empty. That is a very similar issue in the same file, but not in the same place.

The merge request "failure" was just some suggested whitespace changes. I have made those changes and everything is passing now.

rolodmonkey’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Since this is a very reproducible issue think it would be good to get a test case. Probably could extend an existing one with an additional assertion.

sleitner made their first commit to this issue’s fork.

sleitner’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests +Needs Review Queue Initiative

Test coverage can be seen here https://git.drupalcode.org/issue/drupal-3416304/-/jobs/919261

Manually testing fixes the issue.

  • nod_ committed 6923b1a6 on 11.x
    Issue #3416304 by sleitner, RoloDMonkey, smustgrave: Javascript warning...

  • nod_ committed 5cf244cb on 10.3.x
    Issue #3416304 by sleitner, RoloDMonkey, smustgrave: Javascript warning...
nod_’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed
Issue tags: +JavaScript

Committed 6923b1a and pushed to 11.x. Thanks!

  • nod_ committed f4d6cdf6 on 10.2.x
    Issue #3416304 by sleitner, RoloDMonkey, smustgrave: Javascript warning...
nod_’s picture

Version: 10.3.x-dev » 10.2.x-dev
Issue tags: -JavaScript +JavaScript

cherry picked to 10.2.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.