LuteOrg / lute-v3

LUTE = Learning Using Texts: learn languages through reading. Python/Flask.
MIT License
351 stars 41 forks source link

Set focus to translation field on open from reading screen #379

Open jzohrab opened 3 months ago

jzohrab commented 3 months ago

On open from reading screen, the term is created, most natural thing would be to edit the translation. ref discord

Jayanth-Parthsarathy commented 3 months ago

Hey @jzohrab I would like to work on this. Please assign this to me.

Jayanth-Parthsarathy commented 3 months ago

Would adding a autofocus attribute to the {form.translation} field in the term/_form.html be a good start? It seems to work when I click on any of the terms on the read page.

jzohrab commented 3 months ago

Hi @Jayanth-Parthsarathy - thanks very much! (Sorry have been travelling and busy) Autofocus should only be set if the language and term are already set:

Makes sense?

Jayanth-Parthsarathy commented 3 months ago

Understood, thanks for the clarification :)

jzohrab commented 2 months ago

@Jayanth-Parthsarathy did this work in #390 but I disabled it -- it has the unfortunate side-effect of pulling focus from the reading pane, which is a hassle when I'm quickly moving from term to term using the cursor keys. Perhaps there's a way to set the focus in the translation field when the form first gets the focus, so that the reading pane keeps the focus.