Clicking outside BODY element should make selection empty
Reported by
k.litwin...@cksource.com,
Jul 9
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 Steps to reproduce the problem: 1. Create and open simple html file like following: `<html><body contenteditable='true'>Text</body></html>` 2. Open console, and select text. 3. Click once below text. 4. Type in console: `document.activeElement` // Logs body as active element `document.getSelection()` // Chrome and Opera logs selection with 0 ranges But Firefox and Safari logs selection at the end of editable textnode. And this is what I would expect from browser in such case. 5. Place collapsed selection at the end of word 'Text'. 6. Click below text. 7. Type in console: `document.getSelection()` // Here Chrome logs collapsed selection which represents last caret position. Which actually makes sense, but this is inconsistent behaviour comparing to step 4. What is the expected behavior? In step 4 Chrome should behave in same way as in step 7. What went wrong? In step 4 selection has no ranges. Did this work before? N/A Does this work in other browsers? N/A Chrome version: 67.0.3396.99 Channel: stable OS Version: OS X 10.13.5 Flash Version:
,
Jul 9
,
Jul 10
Mark WontFix since - I could not reproduce. When I click below "Text" after make selection range and place collapsed selection at end of "Text". - Hit testing returns null position for outside of viewport On Edge and Firefox, dragging mouse below "Text" makes range selection but Chrome doesn't.
,
Aug 13
yosin@chromium.org in order to reproduce this problem you need to select text and then click on any `body` element `margin` (top, bottom, right or left). I have modified a testfile.html by adding bigger margins so that it is easier to reproduce. In Chrome, clicking on a `margin` and then executing `document.getSelection()` returns `rangeCount` 0 while in browsers like Firefox the reangeCount is 1. Executing `document.activeElement` returns `body` element for both browsers. Taking that into account, I don't this Chrome behavior is correct. NOTE: You can check where the `body` margins are by selecting the `body` element with Element Selector in Chrome dev-tools. Margins will be salmon-colored.
,
Aug 14
j.swiderski@, thanks for providing HTML in #c5. I could reproduce this. I think click outside of <body> should make selection empty instead of keeping selection. |
||||
►
Sign in to add a comment |
||||
Comment 1 by erikc...@chromium.org
, Jul 9