Closed Bug 1755215 Opened 2 years ago Closed 2 years ago

text selection is lost on medium.com in Firefox, but not in Chrome

Categories

(Core :: DOM: Selection, defect)

Firefox 96
defect

Tracking

()

RESOLVED FIXED
Webcompat Priority P2
Tracking Status
firefox97 --- affected
firefox98 --- affected
firefox99 --- affected

People

(Reporter: ksenia, Unassigned)

References

()

Details

Attachments

(1 file)

Attached file 95826.html

We've received a report in https://github.com/webcompat/web-bugs/issues/95826 about a problem on medium.com where upon selecting text on the page, the selection is lost.

This is happening because the site is using .focus() on a different element in the mouseup event handler. I've attached a reduced test case.

To reproduce:
Open the attached test case, select text on the page and release the mouse button to trigger mouseup event.

The site is relying on Chrome's behaviour, where selection is kept.

Severity: -- → S2
Flags: needinfo?(masayuki)

Hmm, aligning the behavior to Chrome could break something other thins, e.g., caret browsing and/or a11y module...

However, according to this comment,

// update the caret visibility and position to match the newly focused
// element. However, don't update the position if this was a focus due to a
// mouse click as the selection code would already have moved the caret as
// needed. If this is a different document than was focused before, also
// update the caret's visibility. If this is the same document, the caret
// visibility should be the same as before so there is no need to update it.

Not updating Selection in this scenario seems okay.

Flags: needinfo?(masayuki)

FWIW selection is also lost in WebKitGTK. I think collapsing selection here makes a fair amount of sense.. Maybe we can contact Medium?

FWIW,
Select text in any website, then press [Tab] key to move focus.
The selection is lost in Firefox, but not in Chrome if the focused element is in the document.

FWIW selection is also lost in WebKitGTK. I think collapsing selection here makes a fair amount of sense.. Maybe we can contact Medium?

I've reached out to Medium via https://help.medium.com/hc/en-us/requests/new (support ticket #740098)

Here is the update from Medium:

Hello,
Thanks for reaching out. We do have a ticket tracking this issue, and the team is working on it now.
I've added your email to the ticket. Please bear with us while we get to it.

We should open a bug on chromium
and eventually the spec if the spec is not clear enough, maybe html spec.

Flags: needinfo?(kdubost)
Flags: needinfo?(kberezina)

The selection is lost on WebKit too.

Anne, would you know if it's an issue worth opening on the HTML spec.
https://w3c.github.io/selection-api/
https://html.spec.whatwg.org/

I opened a bug on Chromium
https://bugs.chromium.org/p/chromium/issues/detail?id=1300132

Flags: needinfo?(kdubost)
Flags: needinfo?(kberezina)
Flags: needinfo?(annevk)
Flags: needinfo?(annevk)
Webcompat Priority: ? → P2

This has been addressed by Medium.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: