Open Bug 1619513 Opened 4 years ago Updated 2 years ago

user-select: none in table adds linebreaks to copied text

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect, P3)

defect

Tracking

()

Tracking Status
firefox73 --- affected
firefox74 --- affected
firefox75 --- affected
firefox93 --- affected

People

(Reporter: mortenok, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: parity-chrome)

Attachments

(1 file)

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

Steps to reproduce:

Copied text in a table where some special content had user-select: none;

<table>
<caption>A table with some special text in a span with user-select:none;</caption>
<thead>
<tr>
<th>Much</th>
<th>Wow</th>
<th>Such</th>
<th>Select</th>
</tr>

</thead>
<tbody>
<tr>
<td>I</td>
<td>am</td>
<td>a <span style="user-select: none;">special</span></td>
<td>row</td>
</tr>
<tr>
<td>I</td>
<td>am</td>
<td>a</td>
<td>row</td>
</tr>
</tbody>
</table>

Given this markup:
1. Select text in the table and copy it
2. Paste the text anywhere (f.ex in a spreadsheet)

codepen to reproduce: https://codepen.io/mortenok/pen/oNXezbm

Actual results:

The copied text contained linebreaks in the positions where the non-selectable text was in the original table.

Note that this works fine when using the special Firefox funtionality (cmd+select) for selecting table data.

Expected results:

No linebreaks should be added.

Attached file table.html

Hi,

I've managed to reproduced the issue on Firefox 73.0.1 and Firefox Nightly 75.0a1
I'm setting a component in order to involve the development team in reviewing this issue.
If this isn't the correct one, feel free to set it to a more suitable one.

Thank you for reporting!

Status: UNCONFIRMED → NEW
Component: Untriaged → DOM: Serializers
Ever confirmed: true
OS: Unspecified → All
Product: Firefox → Core
Version: 73 Branch → Trunk

Thanks for the clear test case.

Priority: -- → P3
Component: DOM: Serializers → DOM: Copy & Paste and Drag & Drop
Keywords: parity-chrome
Hardware: Unspecified → All

The exported HTML is even more broken than the plaintext:

$ xclip -o -t text/html
<meta http-equiv="content-type" content="text/html; charset=utf-8"><table><thead><tr><th>Much</th>
          <th>Wow</th>
          <th>Such</th>
          <th>Select</th>
        </tr>

      </thead>
      <tbody>
        <tr>
          <td>I</td>
          <td>am</td>
          <td>a </td></tr></tbody></table><table><tbody><tr><td>row</td>
        </tr>
        <tr>
          <td>I</td>
          <td>am</td>
          <td>a</td>
          <td>row</td></tr></tbody></table>

It would be interesting to learn about real use-cases of user-select: none within tables. From a UX perspective, that seems undesirable.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: