Commentative / commentative

Add your thoughts when sharing content
https://commentative.herokuapp.com/
GNU General Public License v3.0
5 stars 1 forks source link

Can't comment without scrolling. #27

Open mbanerjeepalmer opened 4 years ago

mbanerjeepalmer commented 4 years ago

If you try to add a comment immediately after submitting a URL, without scrolling down, then you get an error:

    addComment http://127.0.0.1:3000/js/newarticle.js:36

Seems no paragraph is selected when the user hasn't scrolled at all.

The expected behaviour is that the user comments on the whole article.

reubengt commented 4 years ago

@mbanerjeepalmer would a possible solution be to only show the comment box after the user has scrolled and selected a paragraph? our database isnt currently designed to support commenting on the article as a whole.

mbanerjeepalmer commented 4 years ago

Personally I'd argue that the problem is with the assumptions the database makes, in that case. I think this type of tool is much more useful when it's flexible. Instead perhaps we could be less tightly coupled to a particular type of content (i.e. the DOM) and database (i.e. our DynamoDB).

As a short term fix, what about allowing the user to comment on the 0th paragraph? So when the page loads, the selected paragraph is set to 0. Viewers see thoughts left on the whole article and commenters leave comments on the whole article.

(0th is a prescriptive solution. It could be something else, but the basic idea is 'a default that the database understands.'

reubengt commented 4 years ago

I'll have a look into this, but this requires a change in UI too.

currently the comments dont display until you scroll-select a paragraph.

would a comment on the whole article be displayed in the same manner to paragraph comments(in terms of location on the page) - this would mean that it disappears to give way to paragraph comments when the user scrolls.

alternative is to have the "whole article" type of comments show up somewhere else, like maybe at the end of the article like a traditional blog post/news article.

mbanerjeepalmer commented 4 years ago

I'd suggest the first solution. A response to the whole piece of content shows in the normal UI, but only at the top. That way there's a parallel between what the commenter and reader see.

Regarding the implementation

currently the comments dont display until you scroll-select a paragraph.

As far as I can see the box does appear when you first paste a link. So I'm suggesting that when it first loads, perhaps we set the selected index to 0. That way, both commenter and reader comment/view according to the default value. Then when the user scrolls down we increment the value.

You'd need to think about the edge case though: what happens when a user wants to go back up and see/respond to the comment on the 0th index? Do we set the value to 0 when they reach the top? How would they then reach the 1st paragraph in that case? Maybe we give them some overflow area?

Just some suggestions. Up to you how you want to implement - you're writing the code here.