WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9042 closed defect (bug) (wontfix)

Duplicate id "comment_parent" when using TinyMCE on comments

Reported by: bforchhammer Owned by: azaozz
Milestone: Priority: normal
Severity: major Version: 2.7
Component: TinyMCE Keywords: needs-patch
Focuses: Cc:

Description

When adding a tinymce editor to the comments tinymce adds the wysiwyg editor to the dom inside a new span element. This span element automatically gets the id "{textarea_id}_parent" which in case of the comment textarea is "comment_parent".

The new comment form in wp2.7 also requires a hidden input field "comment_parent" for the threaded comments (and inline reply) to work.

Having the same id twice is (apart from being invalid according to w3c standards) causing problems with the tinymce integration...

Attachments (1)

9042.patch (1.6 KB) - added by hakre 5 years ago.
Needed Javascript Changes added

Download all attachments as: .zip

Change History (11)

comment:1 Denis-de-Bernardy5 years ago

  • Component changed from General to JavaScript
  • Keywords needs-patch added; tinymce comment domid removed
  • Milestone changed from 2.7.2 to 2.8
  • Owner changed from anonymous to azaozz

comment:2 Denis-de-Bernardy5 years ago

  • Component changed from JavaScript to TinyMCE

comment:3 Denis-de-Bernardy5 years ago

  • Severity changed from normal to major

comment:4 hakre5 years ago

  • Keywords has-patch added; needs-patch removed

Patch: Prevent potential ID collision with TinyMCE Integration (Frontend).

Easy.

comment:5 Denis-de-Bernardy5 years ago

  • Keywords needs-testing added

this might break the js that sets that field's value when the comment form is moved around when threaded comments are enabled.

hakre5 years ago

Needed Javascript Changes added

comment:6 hakre5 years ago

  • Keywords 2nd-opinion added; needs-testing removed

tested it and you are perfectly right, that broke the moving around of the comment form. i updated the patch sothat the movement of the form works as intended.

tested.

comment:7 Denis-de-Bernardy5 years ago

  • Keywords tested commit added; 2nd-opinion removed

comment:8 azaozz5 years ago

Don't think there's an easy way to do this. Changing the id would break all themes that use custom js for replying to threaded comment. On the other hand the parent id is hard-coded in TinyMCE...

Perhaps the right way would be to change it only when adding TinyMCE on the comment's textarea (the default comment-reply.js can be overwritten then).

comment:9 follow-up: Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; has-patch tested commit removed

k, so we'd need to make sure this can be done with a plugin.

comment:10 in reply to: ↑ 9 azaozz5 years ago

  • Milestone 2.8 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Replying to Denis-de-Bernardy:

k, so we'd need to make sure this can be done with a plugin.

All that's needed is a filter on comment_id_fields() I think. The same can be done from js even easier though, not sure if it's worth filtering the template tag:

document.getElementById('comment_parent').id = 'new_id';
Note: See TracTickets for help on using tickets.