w3c / w3c/csswg-drafts

Copying text of elements that are visually adjacent

Open
#8,732 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-content-3 css-display-4
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

Take some markup like:

<unknown>
  <unknown>one two</unknown>
  <unknown>three four</unknown>
</unknown>

These elements can appear adjacent via a number of layout systems, such as inline-block, table, floats, flex, grid.

Depending on container width, they could appear visually in a variety of ways:

one twothree four
---
onethree
twofour
---
one twothree
       four

What should be in the clipboard when the user copies this text? Does it depend on the layout system used? Does it depend on the elements used? Does it depend on container width?

In this example where I try to emulate VSCode's wrapping style, I'd like visually adjacent elements to be copied as if they're adjacent.

However, I can see cases, such as a row of two paragraphs, where I'd want them to be copied in the same way as two block elements.

Should this be author controllable?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the markup and the linked JS Bin example, then compare expected clipboard text for inline-block, table, float, flex, and grid layouts across the shown wrapping cases. Done means a clear resolution for whether copying follows visual adjacency, element type, layout system, or author-controlled behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.