etherpad-lite
etherpad-lite copied to clipboard
Facility to prevent focus theft when embedded (in Element for example)
name: Prevent focus theft about: title: '' labels: enhancement assignees:
Is your feature request related to a problem? Please describe.
Please see this issue reported for the Element chat client (for the Matrix chat protocol), which has a facility to embed Etherpad as a widget:
"reports that etherpad widget can steal keyboard focus entirely from MessageComposer #5130" https://github.com/vector-im/element-web/issues/5130
TL;DR Etherpad takes a significant time to load when entering a room, at which point it steals keyboard input focus (often part-way through typing something), and chaos ensues.
Describe the solution you'd like Would be good to have a way to prevent Etherpad from stealing focus.
Describe alternatives you've considered A change to Element might help, however this is not straightforward according to the dev updates to the issue above.
I'm not 100% sure if I understand the problem:
<html>
<body>
<textarea id="textarea" name="textarea" rows="10" cols="50">
</textarea>
<iframe src='https://paddomain/p/pad#L4?showChat=false&showLineNumbers=false' width=600 height=400>
</iframe>
</body>
</html>
During load of this HTML file, I can type in the textarea. However, when etherpad finishes loading, the focus suddenly jumps into the pad. Is this what you mean?
Yes, that's exactly what I mean. :-)
OK. I think we can detect if we're in an embedded context (ace_inner.parent.parent != window.top) and if yes don't set focus
Sounds like a good idea to my untrained ear!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Should I comment to keep this one alive? Is this question rhetorical?
same here @ScottRochford , Hope this won't be closed. Regards
I put forward a patch, I'm a little uneasy about this being a default user experience change tho.. Should we consider putting this under a setting in settings.json? I can imagine some embedded user experiences might want to draw focus on pad load?
Hi @JohnMcLear you asked a great question. For example we have multiple use cases in our company :
- Pad is used as a standalone behind an apache proxy
- Pad is used as an embedded tool in Odoo for task descriptions and collaboration
- Once we imagined to use the pad as an embedded tool in an homemade software which purpose is to write things
As you can see, with the same installation, we don't need to focus in the odoo installation and we need the focus with the latest case. So you're totally right by saying that having something systematic could not fulfill all the use cases. Having an option should be great and IMHO maybe it should be activated regarding the source of the http query.
Hope this little summary could help you to think about this. Actually, our teams are fan of the pad and they would be very happy to see you achieve this . Is there any way we could contribute even financially ?
Regards
RE http query, that's actually really the best approach here. @flotho If you want to contribute we have Github sponsors: https://github.com/ether/ - it's never expected but always appreciated and all funds go to devs.
I will try sort out http param approach today, that should be a walk in the park.
Ready for testing and feedback :)
Hi @JohnMcLear , which branch do we need to use for testing ?
Regards
Hi @JohnMcLear , which branch do we need to use for testing ?
jm-dont-focus-when-embedded (see pull request #5173)
Hi @JohnMcLear I'm really happy to inform you that it's working perfectly, Used in Oodo the focus is not taking over the original focus. A big thanks to you!
Regards