﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	focuses
48543	Uncaught TypeError in comment-reply.js when 'id_form' is not 'commentform'	raamdev	SergeyBiryukov	"When `comment_form()` is passed and `id_form` argument other than the default of `commentform`, clicking the Reply link on a comment produces the following error in the JavaScript console:

`Uncaught TypeError: Cannot read property 'addEventListener' of null`

This results in the page refreshing and defaulting to the non-JS behavior, breaking the intended functionality of moving the comment reply form underneath the comment being replied to.

It looks like this bug was introduced in r45790, where it's assumed that `commentFormElement` contains a non-null reference to the comment form ID (`config.commentFormId`), which is set to an ID of `commentform`. If the ID is anything other than `commentform`, the Uncaught TypeError is produced.

To reproduce the bug in trunk, you can modify `comment_form()` in `twentynineteen/inc/template-tags.php` to specify a custom comment form element id attribute (anything other than the default of `commentform` produces the bug):

{{{#!php
<?php
comment_form(
		array(
			'logged_in_as' => null,
			'title_reply'  => null,
			'id_form' => 'commentform-' . get_the_ID()
		)
	);
}}}
"	defect (bug)	closed	normal	5.3	Comments	5.3	normal	fixed	has-patch commit dev-reviewed		javascript
