Why doesn't s9y "jump" to a previewed comment?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Why doesn't s9y "jump" to a previewed comment?

Post by yellowled »

Blogs powered by s9y (can) have a button in the comment form which displays a preview of the comment a user is about to submit. As far as I have been testing this with various templates, s9y does not "jump" to the generated temporary preview of the comment once the user hits "preview".

My question is: Why not? Currently, once a user hits "preview", the page is reloaded including the preview of the comment, but the part of the page the user gets to see is the comment form, which in my humble opinion is not the natural choice, the output a user would expect.

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Why doesn't s9y "jump" to a previewed comment?

Post by garvinhicking »

Hi!

Actually, simply because the ID "feedback" is the place where feedback happens to inform you of comment moderation etc. The preview simply jumps to the same place because 'preview' is just a modified version of 'submit'.

Technically it is impossible (without javascript) to divert a form action differently depending on the submit button you hit.

Thus, even though I like the idea of jumping to the comment instead of the form, it can introduce unwanted side-effects.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Why doesn't s9y "jump" to a previewed comment?

Post by yellowled »

garvinhicking wrote:The preview simply jumps to the same place because 'preview' is just a modified version of 'submit'.

Technically it is impossible (without javascript) to divert a form action differently depending on the submit button you hit.
Well, currently, every comment has a unique id, right? Even the previewed comment is assigned an id, although it is missing the {$comment.id} part. How about jumping to that id instead of #feedback? Maybe I'm not completely getting this, but in this case it would only be a matter of placing #feedback and possible messages properly, right?
garvinhicking wrote:Thus, even though I like the idea of jumping to the comment instead of the form, it can introduce unwanted side-effects.
What kind of side-effects? I don't mean to be a pain in the rear end about such a small thing, but I've seen this work without javascript in Textpattern, so I'm assuming it can't be that hard to implement ...

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Why doesn't s9y "jump" to a previewed comment?

Post by garvinhicking »

Hi!

But the #feedback is the target of the form independently from which submit button you hit. You cannot change that ID unless you also want to break the usual form submission notifications.
What kind of side-effects? I don't mean to be a pain in the rear end about such a small thing, but I've seen this work without javascript in Textpattern, so I'm assuming it can't be that hard to implement ...
Do you have an example URL?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Why doesn't s9y "jump" to a previewed comment?

Post by yellowled »

garvinhicking wrote:But the #feedback is the target of the form independently from which submit button you hit. You cannot change that ID unless you also want to break the usual form submission notifications.
So why not put the comment preview "below" that id in the output code?
garvinhicking wrote:Do you have an example URL?
Try any commentform at snookerblog.de

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Why doesn't s9y "jump" to a previewed comment?

Post by garvinhicking »

Hi!

Okay, that site alwys jumps to #cpreview. In that blog it's not so hard because #cpreview and #feedback (where errors occur) would basically lead to nearly the same place.

However that blog does not have such situations where a nested comment could occur, where your preview comment would be first in list and you'd have to scroll to get to the bottom. In that case you would see your comment when you submit and would not notice that there might have occured errors!?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Why doesn't s9y "jump" to a previewed comment?

Post by yellowled »

garvinhicking wrote:However that blog does not have such situations where a nested comment could occur, where your preview comment would be first in list and you'd have to scroll to get to the bottom. In that case you would see your comment when you submit and would not notice that there might have occured errors!?
Which is exactly why I was suggesting to put the previewed comment right below potential error messages. I don't think it is necessary to preview the comment at the very same place in the comment thread where it will be displayed eventually (although I agree that it would be nice to place it there).

How about a structure like this:

Code: Select all

<a id="feedback"></a>
[Feedback messages]
[Preview of the comment]
This preview could even be additional to the one in the comment thread (which I assume would be hard to suppress).

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Why doesn't s9y "jump" to a previewed comment?

Post by garvinhicking »

Hi!

Hm, I always preferred to see my comment indented/nested at exactly the place where it would go later...so I'm not really in favor of moving the previewed comment to the place where error messages are shown...

Code: Select all

<a id="feedback"></a>
[Feedback messages]
[Preview of the comment]
I'm not sure if this is possible with the current templates, that would need to be tried. The comments are added to a commenstack that currently is printed in entries.tpl, not comment(s/form).tpl...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply