element-hq / element-hq/element-web
Starting to type with the composer deselected should put the cursor at the last position instead of beginning
- Dominant language
- TypeScript
- Stars
- 13.5k
- Forks
- 2.8k
- PR merge metrics
- PR metrics pending
Description
### Your use case
#### What would you like to do?
Element has the imo great feature that if I don't have another input box selected, the composer is often(*) selected by default as it usually is the only input box. (I'm gonna disregard threads for now. Although they need to be considered for this feature, my feeling is that it can just be done without impact to the current behavior.)
(*) yeah sadly only often not always, which is a bit inconsistent.
I find it useful, because I can switch rooms etc and either just start typing or even paste something I copied without needing to explicitly select the composer, saving the time to aim and click.
However, whenever the composer is only "implicitly" selected in this way, the cursor gets reset to its beginning. This works in many cases where there isn't yet something in the composer.
Every now and then, I have started composing a message, navigated away and back again. This might be within Element to copy something from another room, or clicking the center of the window in Windows to switch to it. As I start typing to continue composing my message, the cursor behaviour leads to me messing up instead of continuing the message, because the cursor is now at the beginning instead of where I left off.
https://github.com/vector-im/element-web/assets/2803622/f8f3ff93-6dae-47b7-8ee2-e28551b78ff6
#### How would you like to achieve it?
My suggestion is that Element save the cursor position of the composer per-room (unless empty?) and applies it when starting to type with the composer deselected, or clicking in the area between composer and timeline where it selects the composer but is still "before" the message.
https://github.com/vector-im/element-web/assets/2803622/afd413a9-a66b-4f04-907a-f68f22fcefa3
### Have you considered any alternatives?
_No response_
### Additional context
i think the following has the same basic issue, but only complains about the WYSIWYG buttons behavior, which can be changed independent of my suggested change in behaviour https://github.com/vector-im/element-web/issues/23617
Contributor guide
Assessment
This issue has not been assessed yet.