1. Cross-browser selection UI injection flow:

    1. Listen for mouseup on body
    2. When triggered, let s be window.getSelection()
    3. If s.isCollapsed === false, return
    4. Else, let r be s.getRangeAt(0)
    5. Create a new element e
    6. Call r.surroundContents(e)
    7. e.innerHTML and e.textContent now return useful values, and e’s coordinates can be used to inject UI into the page

    To resolve: what element should e be? Or more accurately, what display property should it have? Possibly inline-block (inline mucks up if selection is across block elements, block mucks up selections within text nodes)

    Turns out there are problems with r.surroundContent, namely that it does not handle partial element selections. See MDNs explanation and solution.
  2. Application of notes or similar: reminding people to contact people in areas they don't go to often. Potential flow:

    • I create an event with a location
    • my software searches my contacts for people in this area
    • a list of those contacts are presented in a non modal fashion
    • If I can't remember where I met the person, hovering on them shows date and location of when I added them to my contacts