mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-07 21:26:13 +02:00
Three problems prevented the document editor from being usable: 1. The contentEditable div inherited composer sizing (~22px tall) so clicks in the document content area landed outside it and bubbled up to the mx_RoomView div[tabIndex=-1], making the whole room view flash blue instead of focusing the editor. Fixed by making the Editor stack fill the full content area height in _DocumentView.pcss. 2. useSetCursorPosition was not called, so even when the editor received focus there was no selection range and no visible cursor. Added the hook call (same pattern as WysiwygComposer). 3. Any click outside the now-tall contentEditable div (e.g. in padding) still fell through. Added an onClick handler on the content wrapper that calls ref.current.focus() when the click target isn't the editor itself, ensuring any click in the document area focuses the editor. Bonus: suppress the browser default outline on .mx_RoomView:focus so pressing a key no longer shows a blue box around the entire room view. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>