| Summary: | Textarea selection does not return the caret position on focus event | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | Forms | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | ap, bfulgham, cdumez, karlcow, rniwa, webkit-bug-importer, wenson_hsieh |
| Priority: | P2 | Keywords: | BrowserCompat, InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: |
https://bugs.webkit.org/show_bug.cgi?id=245269 https://bugs.webkit.org/show_bug.cgi?id=274367 |
||
|
Description
Ahmad Saleem
2022-09-09 07:03:18 PDT
Hm... Chrome also seems to fail this test. Only Firefox shows the right offset when clicking inside the textarea. In my testing, Chrome passes? I think that there are two aspects here: 1. Why are we even removing the focus from textarea when clicking on the button? Seems related to bug 22261. 2. When the focus returns, the selection is restored too late. Compare to this test case: textarea.addEventListener('focus', function (e) { console.log(textarea.selectionStart); // 0 setTimeout(()=>{console.log(textarea.selectionStart)}, 0); // correct offset }); |