-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Implement tab scrolling on tabbar #297
base: main
Are you sure you want to change the base?
Conversation
50b2fde
to
0b65894
Compare
4d8a850
to
e42bcf9
Compare
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.
Thanks for starting this @krassowski
I'm 👍 to use real buttons.
let scrollBeforeButtonClicked = | ||
this.scrollingEnabled && | ||
this.scrollBeforeButtonNode.contains(event.target as HTMLElement); | ||
|
||
let scrollAfterButtonClicked = | ||
this.scrollingEnabled && | ||
this.scrollAfterButtonNode.contains(event.target as HTMLElement); |
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.
Could we add the event listeners directly on the buttons instead of looking afterwards?
let overBeforeScrollButton = | ||
this.scrollingEnabled && | ||
this.scrollBeforeButtonNode.contains(event.target as HTMLElement); | ||
|
||
let overAfterScrollButton = | ||
this.scrollingEnabled && | ||
this.scrollAfterButtonNode.contains(event.target as HTMLElement); |
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.
Same question
Adding my overall review here (I tested both PRs together): Testing this locally I've found a few issues/oddities:
Note that I tested this on Safari 15.3 I'll come back to test this a bit more later, as for the code I saw no large issues with it, but will admit the scroll handling code was a bit dense to understand since I haven't dealt with scroll handling in years |
A code point I forgot: Is this still considered backwards compatible if we change the DOM structure? I'm not sure how detailed jupyterlab defines API breaks, does it include changes to the DOM? If so would this even be valid for lab 3.4? |
@ajbozarth I don't see this. Could you please circle the fragment you are referring or link before-after pictures? |
- smoother: use `requestAnimationFrame` instead of `setInterval` - dragging: - detach by scrolling (requires scroll delta computation) - update drag when scrolling (by dispatching last event again to invoke handler as if mouse moved) - wheel: allow to scroll using mouse wheel
Reducing the complexity of the logic and fixing tab add/close actions
0aa8bfe
to
9345a61
Compare
072a670
to
c4e1513
Compare
This could be solved by using a dummy element which intercepts scroll events as in #652 - which is the recommended approach (as compared to using mouse wheel event as this PR attempted). |
As a solution to jupyterlab/jupyterlab#10305 I would like to propose adding (optional) tabbar scrolling.
Downstream applications need to define
min-width
on tabs for scrolling to work reasonably.Associated JupyterLab PR: jupyterlab/jupyterlab#12278
TODO:
User facing changes
Users can scroll:
Backward compatibility
One wrapper div was added to the DOM hierarchy which may invalidate some some of the downstream CSS styles (if they use strict
>
operator). Otherwise this PR aims to be backward compatible.