element-hq / element-hq/element-web

Keyboard races with clipboard when pasting text into the composer

Open
#31,370 0 comments 0 reactions 0 assignees View on GitHub
A-Composer O-Occasional S-Major T-Defect
Dominant language
TypeScript
Stars
13.5k
Forks
2.8k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

* Go to a room
* Do something which consumes some CPU (e.g. open the Threads Panel; app is catching up on being offline for a bit; app has just launched)
* Paste a URL into the composer and immediately type some text - e.g. "https://example.com is an example" where `https://example.com` is a url pasted from the clipboard.
* Discover that the composer has processed the input as " is an examplehttps://example.com"
* In other words, processing the URL paste event has incorrectly raced and lost the race with processing keyboard input events.
* This is *not* with RTE enabled; just plain old composer.

For example, the text typed below was "https://example.com is at est" (i typoed the space as my spacebar is sticky) in a room which was lagging due to ThreadPanel opening. I promise I pasted the https://example.com url chronologically prior to manually typing " is at est". But it came out like this:

https://github.com/user-attachments/assets/38141cac-56e8-4550-81f2-6a1a3df2910f

### Outcome

#### What did you expect?

Composer should process events should be processed in the order they happened.

#### What happened instead?

Composer processed the clipboard paste event after the keyboard input events, even though it chronologically happened first.

### Operating system

macOS 15.7.1

### Application version

Dev build of ED (60c24828) - Element version: 1.12.3 Crypto version: Rust SDK 0.13.0 (f64839e), Vodozemac 0.9.0

### How did you install the app?

_No response_

### Homeserver

matrix.org

### Will you send logs?

No

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reproducing the race in the plain composer while the app is under CPU load, then trace how clipboard paste and keyboard input events are handled. Done means pasted text remains before the text typed immediately afterward, with coverage for the reported ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.