Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection.direction spec issue, what should happen on multiple click? #177

Open
mozesstumpf opened this issue May 27, 2024 · 5 comments
Open

Comments

@mozesstumpf
Copy link

mozesstumpf commented May 27, 2024

Based on the documentation, it only specifies the Selection.direction based on the position of the boundary-points.

Selection.direction

(...) first indicated boundary point is after the second, then the corresponding selection must initially be backwards. If the first indicated boundary point is before the second, then the corresponding selection must initially be forwards. Otherwise, it must be directionless.

The spec does not mention what should happen in case of double or triple click, when a whole word/line is selected.

The Mozilla's position is that the direction should be "none" in case of double-click, since it does not involve any direction.
Bugzilla: Selection.direction's value is incorrect

My opinion is that the direction would be useful if its value were calculated based on the positions of the boundary points, because I don't see any advantage of knowing whether the selection was made by mouse dragging or multiple-click.

@annevk
Copy link
Member

annevk commented May 28, 2024

WebKit also returns none. I'd be rather worried this would be a breaking change.

@mozesstumpf
Copy link
Author

mozesstumpf commented May 29, 2024

WebKit also returns none. I'd be rather worried this would be a breaking change.

Yes, it would be a breaking change, but since it does not work properly in Gecko (bug report), nor Webkit (bug report) and it hasn't shipped to chromium yet, I don't think that it would currently break any website.

My concern is, that I do believe that the only use case where the direction property would be useful is to determine whether the anchor is before, after, or equal with the focus boundary-point.

I've been actively working on a contenteditable for a while and as the direction currently works, I don't see any advantage of it and I can't think to a case where I could use it as it's implemented right now.

@zcorpan
Copy link
Member

zcorpan commented Jun 3, 2024

If I understand from the WebKit bug, to match macOS conventions, the selection should be directionless in more cases than what the spec currently requires. I think it makes sense to match platform conventions, which suggests changing the spec to allow more flexibility.

@annevk
Copy link
Member

annevk commented Jul 2, 2024

Given Simon's comment this should prolly remain open.

@annevk annevk reopened this Jul 2, 2024
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 8, 2024
Add selection.direction [1] which returns "none", "forward" or
"backward".

We also update the WPT test selection-direction.tentative.html
to remove the selection click-based tests as this behavior is not
standardized across browsers [2] [3].

[1] https://w3c.github.io/selection-api/#dom-selection-direction
[2] w3c/selection-api#70 (comment)
[3] w3c/selection-api#177 (comment)

Change-Id: I2aad4f8efc4f3d700437501929af274116f7910a
Bug: 40286116
aarongable pushed a commit to chromium/chromium that referenced this issue Jul 8, 2024
Add selection.direction [1] which returns "none", "forward" or
"backward".

We also update the WPT test selection-direction.tentative.html
to remove the selection click-based tests as this behavior is not
standardized across browsers [2] [3].

[1] https://w3c.github.io/selection-api/#dom-selection-direction
[2] w3c/selection-api#70 (comment)
[3] w3c/selection-api#177 (comment)

Change-Id: I2aad4f8efc4f3d700437501929af274116f7910a
Bug: 40286116
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5677331
Commit-Queue: Di Zhang <[email protected]>
Reviewed-by: Kent Tamura <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1324573}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 8, 2024
Add selection.direction [1] which returns "none", "forward" or
"backward".

We also update the WPT test selection-direction.tentative.html
to remove the selection click-based tests as this behavior is not
standardized across browsers [2] [3].

[1] https://w3c.github.io/selection-api/#dom-selection-direction
[2] w3c/selection-api#70 (comment)
[3] w3c/selection-api#177 (comment)

Change-Id: I2aad4f8efc4f3d700437501929af274116f7910a
Bug: 40286116
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5677331
Commit-Queue: Di Zhang <[email protected]>
Reviewed-by: Kent Tamura <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1324573}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 9, 2024
Add selection.direction [1] which returns "none", "forward" or
"backward".

We also update the WPT test selection-direction.tentative.html
to remove the selection click-based tests as this behavior is not
standardized across browsers [2] [3].

[1] https://w3c.github.io/selection-api/#dom-selection-direction
[2] w3c/selection-api#70 (comment)
[3] w3c/selection-api#177 (comment)

Change-Id: I2aad4f8efc4f3d700437501929af274116f7910a
Bug: 40286116
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5677331
Commit-Queue: Di Zhang <[email protected]>
Reviewed-by: Kent Tamura <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1324573}
@sefeng211
Copy link

Generally which nodes are selected with double/tripple clicks are implementation specific, so if we use the selected nodes to determine the direction, then it would be non-interoperable. So likely the only interoperable solution would be returning "none" here?

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Jul 11, 2024
…ction, a=testonly

Automatic update from web-platform-tests
[Selection API] Implement selection.direction

Add selection.direction [1] which returns "none", "forward" or
"backward".

We also update the WPT test selection-direction.tentative.html
to remove the selection click-based tests as this behavior is not
standardized across browsers [2] [3].

[1] https://w3c.github.io/selection-api/#dom-selection-direction
[2] w3c/selection-api#70 (comment)
[3] w3c/selection-api#177 (comment)

Change-Id: I2aad4f8efc4f3d700437501929af274116f7910a
Bug: 40286116
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5677331
Commit-Queue: Di Zhang <[email protected]>
Reviewed-by: Kent Tamura <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1324573}

--

wpt-commits: 15c5ae88f39e8599f9b03ee523ddd4f89ab269d0
wpt-pr: 47043
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this issue Jul 13, 2024
…ction, a=testonly

Automatic update from web-platform-tests
[Selection API] Implement selection.direction

Add selection.direction [1] which returns "none", "forward" or
"backward".

We also update the WPT test selection-direction.tentative.html
to remove the selection click-based tests as this behavior is not
standardized across browsers [2] [3].

[1] https://w3c.github.io/selection-api/#dom-selection-direction
[2] w3c/selection-api#70 (comment)
[3] w3c/selection-api#177 (comment)

Change-Id: I2aad4f8efc4f3d700437501929af274116f7910a
Bug: 40286116
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5677331
Commit-Queue: Di Zhang <[email protected]>
Reviewed-by: Kent Tamura <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1324573}

--

wpt-commits: 15c5ae88f39e8599f9b03ee523ddd4f89ab269d0
wpt-pr: 47043
sadym-chromium pushed a commit to web-platform-tests/wpt that referenced this issue Jul 18, 2024
Add selection.direction [1] which returns "none", "forward" or
"backward".

We also update the WPT test selection-direction.tentative.html
to remove the selection click-based tests as this behavior is not
standardized across browsers [2] [3].

[1] https://w3c.github.io/selection-api/#dom-selection-direction
[2] w3c/selection-api#70 (comment)
[3] w3c/selection-api#177 (comment)

Change-Id: I2aad4f8efc4f3d700437501929af274116f7910a
Bug: 40286116
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5677331
Commit-Queue: Di Zhang <[email protected]>
Reviewed-by: Kent Tamura <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1324573}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants