[w3c/selection-api] Inconsistent Behavior of Softwrap Property in Textarea Across Browsers (Issue #349)

pranavmodi25 created an issue (w3c/selection-api#349)

**Expected Behaviour**: 
When the cursor is placed at the beginning of a line in a textarea with the softwrap property and the space key is pressed, the cursor should remain on the same line, and spaces should be added to the current line.

**Actual Behaviour**: 

- In Chromium-based browsers, pressing the space key at the beginning of a line moves the text to the next line along with the cursor. Subsequent spaces keep adding new lines.

- In WebKit-based browsers, pressing the space key at the beginning of a line keeps the cursor at the beginning and adds spaces to the previous line.

- In Firefox, pressing the space key at the beginning of a line keeps the cursor on the same line, and spaces are added to the current line.

**Impact**:
- The inconsistent behaviour across browsers affects the user experience and can lead to confusion and incorrect text formatting in web applications that rely on the softwrap property in textareas.

**Steps to Reproduce**:
1. Create a textarea with the softwrap property and add text that wraps to at least three lines.
2. Place the cursor at the beginning of a line.
3. Press the space key and observe the behaviour in different browsers (Chromium-based, WebKit-based, and Firefox).

**Proposed Specification Change**:
- The specification should follow the behaviour observed in Firefox, where pressing the space key at the beginning of a line keeps the cursor on the same line and adds spaces to the current line. Visually, when a user presses the space key, the space should be visible to the user as they are entering it. In the current behaviour of Chromium-based and WebKit-based browsers, this is not the case, leading to a confusing user experience. The proposed change ensures that the space is visibly added to the current line, providing a more intuitive and logical experience for the user.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/349
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/selection-api/issues/349@github.com>

Received on Thursday, 3 April 2025 20:21:36 UTC