googlefonts / fontra

A browser-based font editor
https://fontra.xyz
GNU General Public License v3.0
425 stars 19 forks source link

Adding option selectOnFocus for textInput #1477

Closed ollimeier closed 2 weeks ago

ollimeier commented 2 weeks ago

Fixes #1339

I added a new option called selectOnFocus for textInput. This way we can have control over the textInput if it should be selected on focus or not.

For reference:

https://github.com/googlefonts/fontra/assets/21055547/d75af2fc-b3bc-4dd6-8361-2193b09e19d2

justvanrossum commented 2 weeks ago

Doesn’t this also select all if you click on it coming from another field?

ollimeier commented 2 weeks ago

Doesn’t this also select all if you click on it coming from another field?

yes.

justvanrossum commented 2 weeks ago

But that is very unusual behavior, and therefore undesirable.

justvanrossum commented 2 weeks ago

There is already this: https://github.com/googlefonts/fontra/blob/22370183e8aabb71554a97730f3bb3e0b0358689/src/fontra/views/editor/editor.js#L2122-L2125 I think it would be better to add a .select() there.

ollimeier commented 2 weeks ago

There is already this:

https://github.com/googlefonts/fontra/blob/22370183e8aabb71554a97730f3bb3e0b0358689/src/fontra/views/editor/editor.js#L2122-L2125

I think it would be better to add a .select() there.

Ok, thanks for the valid feedback. I changed it.