codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
393 stars 68 forks source link

Exact dates/times for posts/edits/comments are not available on touchscreens #946

Open cellio opened 1 year ago

cellio commented 1 year ago

https://meta.codidact.com/posts/287147

We "smooth" dates/times, like "posted about a month ago" or "edited 2 years ago". On a desktop, you can mouse-over those quasi-dates to see the exact timestamp. On a touch interface, however, you can't. Can we make that information available somehow?

On some sites (this report says), you can long-press on things with tooltips to see the tooltip. I don't know touch conventions well myself, so I don't know if that's an expected norm or "maybe it'll work in some places" or something else. Alternatively, we could just display the timestamp to begin with for mobile devices, unless that would be too crowded.

I don't know what the right answer is, but I'd like us to be able to support mobile users following whatever norms they'd expect.

trichoplax commented 1 year ago

I've just realised I raised that Meta post without mentioning any evidence of sites that allow viewing title text with a long press. I don't know if it's standard or just specific to the site, but here's an example:

On xkcd.com the comic has title text which appears on hover on desktop, and can be viewed on mobile by long pressing anywhere on the comic panel.

On m.xkcd.com (the mobile version of the site) the title text is moved to a superscript phrase "(alt-text)" next to the comic title (below the comic panel) which when pressed displays the title text inline rather than as a temporary box.

Since Codidact automatically displays differently for mobile devices (rather than having a separate m. mobile site, perhaps an explicit button could be present next to the datetime, which when pressed adds the exact timestamp inline?

Alternatively, it might even be better for accessibility if the same solution was implemented for both mobile and desktop. For example, "about a month ago" could be a button, that when clicked or touched changes to an exact timestamp. It could even remain a button after the change, so that repeatedly pressing it switches between exact and "smoothed" datetimes. This would avoid having to change the page when switching between desktop and mobile (for example, when a user resizes a desktop browser window to be narrow enough to trigger the mobile styling). I imagine this would also be significantly easier to implement.

cellio commented 1 year ago

I like the click-to-toggle idea, and as you say, it means we don't have to do different things in different contexts. UI-wise I'd prefer something lighter-weight than a button, maybe just a link or some other lightweight widget. There'll be several of them on a page, some in close proximity (created/edited, comment threads), so we need something that's apparent but not in the way.

trichoplax commented 1 year ago

I probably should have avoided the word "button" in my description - I was trying to express that it could have the functionality of a button (clickable) rather than the styling of a button. Depending on how discoverable it needs to be it could potentially be styled exactly as it is currently (just standard text that changes when clicked).

While transitioning from the current title text approach, maybe it would help existing users who are used to the old way to also have title text that just says something like "Click to toggle date format". That would be no less discoverable than currently, and any extra subtle styling hints could just add to that.

cellio commented 1 year ago

Could still keep the exact date as mouse-over, with "(click to toggle)" or similar to indicate that you can make it stick without hovering if you want.

trichoplax commented 1 year ago

I really like your suggestion of this "best of both" approach with both the date and "(click to toggle)" in the title text on hover.

I imagine it also toggling with the date, so it switches between the following:

trichoplax commented 1 year ago

In the user profiles, the Activity tab has a Date column which uses the same "smoothed" dates as posts and comments. Can this be included as something to change when fixing this issue, or should it be raised as a separate issue? It currently has the same behaviour on hover, of displaying the exact datetime stamp.

cellio commented 1 year ago

In the user profiles, the Activity tab has a Date column which uses the same "smoothed" dates as posts and comments. Can this be included as something to change when fixing this issue, or should it be raised as a separate issue? It currently has the same behaviour on hover, of displaying the exact datetime stamp.

I really hope that's the same code under the hood -- that the list in the profile, category pages, tag lists, and search results are all calling the same function to generate that string.