WICG / webcomponents

Web Components specifications
Other
4.38k stars 375 forks source link

Selection APIs for Shadow DOM #79

Closed hayatoito closed 1 year ago

hayatoito commented 9 years ago

Title: [Shadow]: Find a way for selection to work across shadow DOM subtrees (bugzilla: 15444)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444


comment: 0 comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c0 Dimitri Glazkov wrote on 2012-01-06 18:40:35 +0000.

As specified in http://dvcs.w3.org/hg/webcomponents/rev/3fb19f98bead, window.getSelection() may never retrieve content from shadow DOM subtrees. Also, a user can't select content from both document tree and shadow DOM tree. We must fix that somehow.


comment: 1 comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c1 Dimitri Glazkov wrote on 2012-01-06 20:29:06 +0000.

Should we allow shadow DOM subtrees to specify whether they want to be treated as part of "as-rendered" structure or as a separate subtree?

Currently, for getSelection(), the WebKit implementation returns serialized value of the Selection object inside of a shadow DOM subtree, but node values are adjusted to avoid leaking shadow DOM nodes.


comment: 2 comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c2 Steve Orvell wrote on 2013-09-05 01:50:34 +0000.

This is an important UX concern. I think it's fine to limit access to selection data as defined by the spec. However, users expect to be able to select and copy text in a web page. To have that limited by invisible ShadowDOM boundaries would be very annoying. Ideally, this just always works and is separate from the encapsulation provided via ShadowDOM.


comment: 3 comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c3 Dimitri Glazkov wrote on 2014-03-06 00:11:06 +0000.

One thing that Jonas suggested at the recent spec review is to make our selection language non-normative. It's a tough subject, so we shouldn't freeze this into the spec. The suggestion was to have the language along these lines:

"Selection is not defined. Implementation should do their best to do what's best for them. Here's one possible, admittedly naive way: <insert current normative wording, but make it informative>"


comment: 4 comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c4 Hayato Ito wrote on 2014-03-10 06:09:43 +0000.

(In reply to Dimitri Glazkov from comment #3)

One thing that Jonas suggested at the recent spec review is to make our selection language non-normative. It's a tough subject, so we shouldn't freeze this into the spec. The suggestion was to have the language along these lines:

"Selection is not defined. Implementation should do their best to do what's best for them. Here's one possible, admittedly naive way: <insert current normative wording, but make it informative>"

Done at https://github.com/w3c/webcomponents/commit/25bd518701866866a26d9d7e3e50d90a45f62d93.

I'll keep this bug open until we have a better model, that is a tough issue for us.


comment: 5 comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c5 Dimitri Glazkov wrote on 2014-03-10 16:07:28 +0000.

(In reply to Hayato Ito from comment #4)

(In reply to Dimitri Glazkov from comment #3)

One thing that Jonas suggested at the recent spec review is to make our selection language non-normative. It's a tough subject, so we shouldn't freeze this into the spec. The suggestion was to have the language along these lines:

"Selection is not defined. Implementation should do their best to do what's best for them. Here's one possible, admittedly naive way: <insert current normative wording, but make it informative>"

Done at https://github.com/w3c/webcomponents/commit/ 25bd518701866866a26d9d7e3e50d90a45f62d93.

I'll keep this bug open until we have a better model, that is a tough issue for us.

Maybe kill the 6.1.1 section title and remove the musty language from the non-normative parts?


comment: 6 comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c6 Hayato Ito wrote on 2014-03-11 07:45:41 +0000.

(In reply to Dimitri Glazkov from comment #5)

Maybe kill the 6.1.1 section title and remove the musty language from the non-normative parts?

Sure. Done at https://github.com/w3c/webcomponents/commit/0887618b6f247d1d59f37fbc474313014d81f227


comment: 7 comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c7 Hayato Ito wrote on 2014-11-19 05:06:12 +0000.

* Bug 25038 has been marked as a duplicate of this bug. *


comment: 8 comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c8 Hayato Ito wrote on 2015-04-22 21:31:06 +0000.

Status Update: This bug is still on our radar, but we couldn't spend much time on this issue in terms of the spec.

FYI. In Blink, we are working on supporting selection across shadow boundaries 1. However, there is no update on API in the spec yet.

annevk commented 1 year ago

There's now a draft in https://w3c.github.io/selection-api/#dom-selection-getcomposedrange and a feedback thread at https://github.com/w3c/selection-api/issues/161.

Shall we move discussion there or is there a good reason to keep this open?

mfreed7 commented 1 year ago

There's now a draft in https://w3c.github.io/selection-api/#dom-selection-getcomposedrange and a feedback thread at w3c/selection-api#161.

Shall we move discussion there or is there a good reason to keep this open?

Sounds reasonable to close this and continue the discussion there.