~sircmpwn/todo.sr.ht/#100: Ctrl + Enter should submit the comment/ticket

Status
REPORTED
Submitter
~grayhatter
Submitted
9 months ago
Updated
an hour ago
User Agent
Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Labels
No labels applied.

~benharri 20 hours ago

Is there a way to do this without javascript? I've only been able to fine javascript solutions to this in my first searches.

~jehanne 11 hours ago

Good question!

To my knowledge, without JavaScript, all you can do is to add an access key to an input submit.

Something like

<form ...>
<input type="submit" accesskey="S" value="Submit"/>
</form>

would submit the form by typing Alt+Shift+S.

Not exactly Ctrl+Enter, but something people can learn.

~sircmpwn 10 hours ago

I'm okay with using JavaScript for little details like this. The site has to be useful and pleasant without JS, but we can use small amounts of JS to improve QoL here and there.

We can also set up that accesskey thing, seems neato.

~jehanne an hour ago

Progressive enhancement is a forgotten art I was initiated to a more than a decade ago.

I would argue that with simple explanatory divs one could enhance the quality of life without invoking Balrogs that potentially threat the users security.

However since people using your services is already trusting you (and Let's Encrypt and everyone who has physical access to your servers), few lines of JavaScript shouldn't extend the attacks surface too much.

If I can give a suggestion though, I'd appreciate if you avoid any javascript framework, avoid CDNs, and possibly keep javascript constrained to what can fit the page source, in the script tag, without triggering further request to load further js or json.

It's not just a matter of security: the overall rendering will be faster and the experience better.

But above all, as a hack for hackers, it would be funny to see the mainstream wisdom that the world would collapse in fire if JavaScript were opt-in, challenged by a great service.