Skip to content

Text selection is "jagged" when wrapLongLines and showLineNumbers are set #375

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

Open
rrcobb opened this issue Mar 22, 2021 · 1 comment
Open

Comments

@rrcobb
Copy link

rrcobb commented Mar 22, 2021

Description

When both wrapLongLines and showLineNumber are true, text selection no longer works smoothly.

It looks like this is because of the display: flex applied when both of these properties are true (3686429#L120)

To Reproduce

  1. Visit the demo site: https://react-syntax-highlighter.github.io/react-syntax-highlighter/demo/prism.html
  2. Toggle on both "Show line numbers" and "Wrap long lines" checkboxes
  3. Compare text selection behavior to when those settings are not checked.

Expected behavior
Text selection behavior should be smooth regardless of these settings.

This is especially important for code examples, as copy/paste from snippets is a common expectation.

Screenshots

Smooth text selection:
Screen Shot 2021-03-22 at 4 37 45 PM

"Jagged" text selection
Screen Shot 2021-03-22 at 4 39 04 PM

Additional context
I'm seeing this behavior in Chrome, Version 89.0.4389.90 (Official Build) (x86_64) but I expect it's the same across browsers.

My guess is that display: flex interacts oddly with the user-select property. There's nothing specific about differences between elements with different display values in the draft spec https://drafts.csswg.org/css-ui-4/#content-selection, but I might be missing something.

@rrcobb rrcobb changed the title Text selection is broken when wrapLongLines and showLineNumbers are set Text selection is "jagged" when wrapLongLines and showLineNumbers are set Mar 22, 2021
@jonioni
Copy link

jonioni commented Mar 22, 2021

Encountered similar issue. When having showLineNumbers on, the wrapping broke on simple content:

image

See #376

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

2 participants