[w3c/editing] Inconsistent Behavior of Softwrap Property in Textarea Across Browsers (Issue #482)

pranavmodi25 created an issue (w3c/editing#482)

**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.

![Image](https://github.com/user-attachments/assets/15d24c53-d5c1-4154-98c5-5c936002c48b)

- 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.

![Image](https://github.com/user-attachments/assets/b5b9d310-ad60-4746-883f-eddf90b37adc)

**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).

**Here is a quick link to repro:** [https://codepen.io/pranavmodi/pen/raNPRXG](url)

**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/editing/issues/482
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/editing/issues/482@github.com>

Received on Thursday, 3 April 2025 21:17:18 UTC