Bug 261092 - Fixed selectionEnd for TextArea with text end in newline
Summary: Fixed selectionEnd for TextArea with text end in newline
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, GoodFirstBug
Depends on:
Blocks:
 
Reported: 2023-09-03 15:31 PDT by Ahmad Saleem
Modified: 2023-09-04 17:02 PDT (History)
3 users (show)

See Also:


Attachments
Test Case (outside of JSFiddle) (1.07 KB, text/html)
2023-09-04 13:10 PDT, Ahmad Saleem
no flags Details
testcase for textarea selection (726 bytes, text/html)
2023-09-04 17:02 PDT, Karl Dubost
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2023-09-03 15:31:04 PDT
Hi Team,

While going through Blink's bugs, came across another failing test:

Test Case: https://jsfiddle.net/Loascueh/show

^ Chrome Canary 118 and Firefox Nightly 118 passes this test while WebKit ToT fails this.

Blink Commit: https://chromium.googlesource.com/chromium/src.git/+/a5a503556d3fdec80c655ac0830018e9cca4c091

WebKit Source: https://searchfox.org/wubkat/source/Source/WebCore/html/HTMLTextFormControlElement.cpp#713

Local build patch:

 else if (is<HTMLBRElement>(*node) && node != innerText->lastChild())

^ Passes in WebKit Test Runner:

PASS textarea selection index is correct when text ends in newline

Just wanted to raise so we can fix it.

Thanks!
Comment 1 Karl Dubost 2023-09-03 21:39:23 PDT
Thanks Ahmad.
That seems a low hanging fruit. 
Maybe there should be an additional WPT test for this.
Comment 2 Ahmad Saleem 2023-09-04 13:10:17 PDT
Created attachment 467541 [details]
Test Case (outside of JSFiddle)

It passes in Safari 16.6 without this merge as well. So I am going to close this bug and PR as well.

https://github.com/WebKit/WebKit/pull/17391

JSFiddle messed up 'focus' and was showing me as failing but when I ran it locally, it was passing so no need to merge this.
Comment 3 Karl Dubost 2023-09-04 17:02:48 PDT
Created attachment 467545 [details]
testcase for textarea selection

The wrong test seems to have been uploaded.
Here a new test showing as Ahmad said that the result is correct and equivalent in the 3 browsers. 
The failure for the JSFiddle is related to something else.