Skip to content

[Codebridge] Added weblab and pythonlab shortcuts for run button, console, and editor #65839

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
wants to merge 4 commits into
base: staging
Choose a base branch
from

Conversation

hannahbergam
Copy link
Contributor

@hannahbergam hannahbergam commented May 14, 2025

Adds keyboard shortcuts for the run button (ctrl + r), the editor (ctrl + e) and the console output (ctrl + o) for PythonLab (and the edit shortcut works for Weblab).

I added this in Codebridge so it would work for pythonlab and weblab.

Below is a video! It's a bit hard to follow unless you can see the focus, which I use the shortcuts to move between run button, editor, and output.

This is after hearing from the Maryland School for the Blind kids that they'd like a quicker way to navigate between the most important parts of the page!

I elected to use ctrl + instead of just the letters so that the shortcuts also work from within (and don't interfere with) the text editors (console and workspace editor).

I have a mac, so would appreciate someone testing this on another device!

Screen.Recording.2025-05-14.at.1.22.33.PM.mov

Links

Testing story

Deployment strategy

Follow-up work

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@hannahbergam hannahbergam marked this pull request as ready for review May 14, 2025 20:28
@hannahbergam hannahbergam changed the title Added weblab and pythonlab shortcuts for run button, console, and editor [Codebridge] Added weblab and pythonlab shortcuts for run button, console, and editor May 14, 2025
@hannahbergam hannahbergam requested a review from a team May 14, 2025 20:29
Copy link
Contributor

@sanchitmalhotra126 sanchitmalhotra126 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If helpful, here is the original PR that added a run shortcut for legacy labs! #55942
Two things:

  1. I totally misremembered 🤦 - looks like CTRL+Enter is what we wired up for Run (not CTRL+R)
  2. That PR created a KeyHandler util that may be useful here!

@hannahbergam
Copy link
Contributor Author

If helpful, here is the original PR that added a run shortcut for legacy labs! #55942 Two things:

  1. I totally misremembered 🤦 - looks like CTRL+Enter is what we wired up for Run (not CTRL+R)
  2. That PR created a KeyHandler util that may be useful here!

ooo thank you! I'll take a look at this handler! Also, I might stick with R considering the rest of the shortcuts are letters... but definitely open to feedback.

@hannahbergam
Copy link
Contributor Author

hannahbergam commented May 14, 2025

If helpful, here is the original PR that added a run shortcut for legacy labs! #55942 Two things:

  1. I totally misremembered 🤦 - looks like CTRL+Enter is what we wired up for Run (not CTRL+R)
  2. That PR created a KeyHandler util that may be useful here!

ooo thank you! I'll take a look at this handler! Also, I might stick with R considering the rest of the shortcuts are letters... but definitely open to feedback.

@sanchitmalhotra126 How would you feel about me adding a preventDefault() to the keyHandler?

@hannahbergam
Copy link
Contributor Author

If helpful, here is the original PR that added a run shortcut for legacy labs! #55942 Two things:

  1. I totally misremembered 🤦 - looks like CTRL+Enter is what we wired up for Run (not CTRL+R)
  2. That PR created a KeyHandler util that may be useful here!

ooo thank you! I'll take a look at this handler! Also, I might stick with R considering the rest of the shortcuts are letters... but definitely open to feedback.

@sanchitmalhotra126 How would you feel about me adding a preventDefault() to the keyHandler?

mmm actually this seems to interfere with the rest of the keyboard events so I'm not sure there is an easy way to utilize this util in PythonLab. I would also have to register both ctrl and command, which I believe would make it just as many lines changed😅 Alright with you if I maintain the current approach?

@sanchitmalhotra126
Copy link
Contributor

mmm actually this seems to interfere with the rest of the keyboard events so I'm not sure there is an easy way to utilize this util in PythonLab. I would also have to register both ctrl and command, which I believe would make it just as many lines changed😅 Alright with you if I maintain the current approach?

Yep, totally fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants