-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Do not block shift-click mouse up handler on active cell #16647
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
Conversation
Thanks for making a pull request to jupyterlab! |
Thank you, this looks good. I think we would also want to add a test case, somewhere here: jupyterlab/packages/notebook/test/widget.spec.ts Lines 1233 to 1273 in 653c226
|
Thank you for the support. |
I'm not sure why the tests are failing. After looking at this some more I think the test I added doesn't actually cover the new behavior. For the test case added in this PR, What really needs to be tested is whether the widget is a registered mouse up event listener or whether the the mouse mode is null: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the parens are off
Oops, thanks! I'm currently not setup for JS dev, so no linters :( |
Looks like the test linter doesn't like |
packages/notebook/src/widget.ts
Outdated
// We don't want to block the shift-click mouse up handler | ||
// when the current cell is the active cell. | ||
const isActiveCell = index == this.activeCellIndex; | ||
if ( | ||
button === 0 && | ||
shiftKey && | ||
!hasSelection && | ||
!isActiveCell && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Giving it a bit more thought I think this has to be more subtle. The idea is that user can press Shift, press mouse down and start dragging cursor to select cells. Instead of short-circuiting here I think we should store the activeCellIndex
if starts shift + mousedown on active cell and skip preventing default on _evtDocumentMouseup()
if the cell index has not changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will push a commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @EdsterG! Please let me know once you had a chance to look at the changes I've made and whether you have any comments.
Yay, thanks for pushing the changes. LGTM. |
@meeseeksdev please backport to 4.2.x |
…er on active cell
…ve cell (#16663) Co-authored-by: Eddie Groshev <eddie_g_89@hotmail.com>
…16647) * check if current cell is the active cell * add unit test * update unit test * fix typo in unit tests * Do not use private variables in tests, use events * Do not prevent default on mouse + shift up if in the same cell * Fix the test * Adjust comment --------- Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
References
Fixes #16633
Code changes
Don't prevent default behavior when the current cell is the active cell.
User-facing changes
shift+click
in the same cell no longer swallows themouseup
event.Backwards-incompatible changes
N/A