compiler-explorer / compiler-explorer/compiler-explorer

[BUG]: Selecting text right-to-left causes the next character input to be dropped in Firefox

Open
#8,745 1 comment 0 reactions 0 assignees View on GitHub
bug monaco
Dominant language
TypeScript
Stars
19.1k
Forks
2.1k
Avg merge
3d 15h
Merged PRs (30d)
67

Description

### Describe the bug

Selecting text right-to-left causes the next character input to be dropped in Firefox. Selecting text left-to-right and typing works as expected. Non-character inputs such as delete, backspace, or page down work fine.

I cannot reproduce the issue in chrome, and I've disabled my extensions to make sure they're not interfering with the page somehow.

### Steps to reproduce

1. Visit godbolt.org
2. Select any language to load example code
3. Highlight some code starting from the right and dragging the mouse cursor left
4. Press any character - nothing happens
5. Press any character - the selected text is replaced with the character

This also happens if you select text with the keyboard using shift+home or shift+left instead of using the mouse. Shift+end and shift+right works as expected.

### Expected behavior

When you type, the selected text should always be replaced with the character you typed.

### Reproduction link

Not applicable

### Screenshots

Not applicable

### Operating System

Windows 11

### Browser version

Firefox 151.0.2

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the selection and typing steps on godbolt.org in Firefox, comparing right-to-left and left-to-right selection with mouse and keyboard. Trace the page's text-input and selection handling to find where the first character is dropped; done means the first character replaces the selected text in each listed case without changing the working behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.