Closed Bug 1723903 Opened 5 years ago Closed 5 years ago

Shadow dom breaks text selection of content inside it

Categories

(Core :: DOM: Selection, defect)

Firefox 92
x86_64
macOS
defect

Tracking

()

RESOLVED DUPLICATE of bug 1545367

People

(Reporter: mmis1000, Unassigned)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:92.0) Gecko/20100101 Firefox/92.0

Steps to reproduce:

  1. make a shadowroot to contain elements
  2. move a span that has line-height shorter that containing container into it
  3. try to select text and don't end you selection on the top of text (the cursor changed to arrow)
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <span id="a">
<span>sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds</span>
  </span>
  <br><br>
  <span id="a">
<span>sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds sds</span>
  </span>
  <style>body {
  line-height: 200%;
}
span {
line-height: 16px;
}
  </style>
  <script>
    
const root = document.getElementById('a').attachShadow({mode: 'open'});

[...document.getElementById('a').children].forEach(it => {
  root.appendChild(it)
})
  </script>
</body>
</html>

Actual results:

The select end up end at top of the text block instead of under cursor if you did not hover text at end

Expected results:

The text should be selected normally

OS: Unspecified → macOS
Hardware: Unspecified → x86_64

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Selection' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: Selection
Product: Firefox → Core
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: