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

[Enhanced code blocks] Make console prompts unselectable #177

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

seshrs
Copy link
Member

@seshrs seshrs commented Apr 23, 2022

Context

In #169 (comment), @eecs441staff suggested skipping prompts and output when using click+drag while selecting multiple lines in a console prompt. At the time, I thought it would not be easy to implement given the limitations of the JS text selection API.

I feel a bit silly in retrospect for forgetting to consider the CSS user-select property 😅

This PR proposes making the console prompts in enhanced console code blocks completely unselectable (by clicking line numbers or by selecting text the old-fashioned way).

Demo

Visit the demo URL, and click+drag on the line numbers in the console code block.

Demo URL: https://preview.sesh.rs/previews/eecs485staff/primer-spec/177/demo/enhanced-code-blocks.html#console-example

Screen recording:

Screen.Recording.2022-04-23.at.4.53.52.PM.mov

Open question: Should we make console output unselectable?

It's extremely easy to skip the console output too. However, I wonder if students might find it confusing that they have no way to select the console output. Then again, would students ever need to be able to select the output?

CC @awdeorio, @sugihjamin in case you have strong opinions 😃

@seshrs seshrs added the semver/patch Pull Request proposes "patch" change label Apr 23, 2022
@seshrs seshrs added this to the SP/SU 22 milestone Apr 23, 2022
@github-actions
Copy link
Contributor

The spec from this PR is available at https://preview.sesh.rs/previews/eecs485staff/primer-spec/177/.

(Available until Mon May 23 2022.)

@eecs441staff
Copy link

It seems to me that there should be a way to copy everything as per "normal" behavior. One could select and copy everything if shift is held down or by clicking the copy to clipboard icon?

@seshrs
Copy link
Member Author

seshrs commented Apr 24, 2022

Unfortunately, the user-select property hijacks normal selection behavior. And unfortunately, the better solution is the one I mentioned in my comment, but is only supported on Firefox 😞

It is possible to change the user-select property dynamically (like when holding the shift key), but we’d want to tell students about this feature. Maybe I should only merge this after we have a good resolution for #172

@seshrs seshrs removed this from the SP/SU 22 milestone Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch Pull Request proposes "patch" change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants