0

When replying to an already posted comment, comment-reply.js (or the 'min' version) is used to move the comment form up to below the comment being replied to.

It also gives the focus to the actual 'comment' textarea. If the person commenting is logged in, this makes sense as it is the only input needed and displayed. If the commenter is not logged in, but has previously commented, the 'author', 'email' and 'url' inputs are displayed, but already filled in, so again focusing on the comment textarea makes sense.

However, on many websites, comments will generally be from casual visitors without logins who have not commented before and so need, at least, to complete the name input, but still the focus goes straight to the comment textarea which seems to be odd, counter-intuitive behaviour.

First question: is there some very good reason why this is the best behaviour which I'm just failing to see?

Second question (assuming the answer to the first question is 'no'): is there a straightforward way (preferably without hacking the core) to modify this, so that the focus goes to the first, non-empty, required field?

(I have tested this on a vanilla WordPress installation, using the 2012 theme, so this behaviour is not the result of a theme or plugin. The comment-reply.js file is located in wp-includes/js and I can see the line which focuses on 'comment'. I have tried googling and searching here on StackExchange, but can find no-one else discussing this behaviour.)

0

This is just good user experience (UX): When someone clicks on Comment or Answer, they have started writing their comment already in their mind. Don’t break that flow with secondary fields. This the reason why you should move the textarea to the top.

To change that, you could listen to document changes, check the comment fields to see if they exist, are empty and required, and if the commenter hasn’t started typing already. Then move the cursor. I strongly recommend not to do that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.