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
- Enable the content translation module on a site with a few content types, taxonomies, etc.
- 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.
Merge request link
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
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:
- 3416304-javascript-warning-from
compare
- 11.x
changes, plain diff MR !6276
Comments
Comment #2
rolodmonkey commentedComment #4
rolodmonkey commentedComment #5
rolodmonkey commentedComment #6
rolodmonkey commentedComment #7
rolodmonkey commentedComment #8
rolodmonkey commentedComment #9
smustgrave commentedHave 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.
Comment #10
rolodmonkey commentedAs 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.
Comment #11
rolodmonkey commentedComment #12
smustgrave commentedSince 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.
Comment #14
sleitner commentedComment #15
smustgrave commentedTest coverage can be seen here https://git.drupalcode.org/issue/drupal-3416304/-/jobs/919261
Manually testing fixes the issue.
Comment #18
nod_Committed 6923b1a and pushed to 11.x. Thanks!
Comment #21
nod_cherry picked to 10.2.x