Skip to content

Support selecting DOM text via the mouse #4409

Closed

Description

@jdm

This will require:

  • Watching mousedown/mouseup/mousemove events in the script task
  • Marking elements dragged over as selected
  • Partial selections (like a subset of a text node)
  • Styling selected text differently

We may want a UA-only CSS property that gets applied to any selected element, and have the inline text layout code create multiple flows for selected/non-selected text.

Activity

  1. added
    A-content/dom
    B-interesting-project
    on Dec 17, 2014
  2. pcwalton commented on Dec 18, 2014

    @pcwalton
    Contributor

    Why multiple flows? I would think only multiple fragments are needed if anything.

  3. jdm commented on Dec 18, 2014

    @jdm
    MemberAuthor

    My use of correct layout terminology is haphazard at best.

  4. nhirata commented on Feb 17, 2016

    @nhirata
  5. SimonSapin commented on Mar 4, 2016

    @SimonSapin
    Member

    @nhirata That test page is about the <select> element, right? This issue is about text selection with click + drag:

    screenshot from 2016-03-04 14-42-04

    Or do the two interact?

  6. pshaughn commented on Feb 2, 2020

    @pshaughn
    Contributor

    Is there already functionality to get from a mouse position to a BoundaryPoint (a Node and a u32 offset within the node)? If so then the Selection implementation I'm working on will have checkboxes 2 and 3 covered.

  7. jdm commented on Feb 10, 2020

    @jdm
    MemberAuthor

    Not that I'm aware of. I think the closest thing we have is this code which is used as part of a layout query when you click on text in a text input and we figure out where to place the input cursor as a result.

  8. pshaughn commented on Feb 10, 2020

    @pshaughn
    Contributor

    I see! That looks like it would easily be extended to cover any Text node, but it doesn't cover the other sense of the offset u32, like starting a drag between two images in <span><img><img><img></span> when CSS is leaving a gap between the images.

  9. changed the title [-]Support selecting DOM elements via the mouse[/-] [+]Support selecting DOM text via the mouse[/+] on Aug 19, 2026
  10. added a commit that references this issue on Aug 25, 2026
    c93f007
  11. added a commit that references this issue on Oct 6, 2026
    fb830be
  12. added a commit that references this issue on Oct 12, 2026
    ed5753a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/domA-layout/uncategorizedB-interesting-project

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions