-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactoring Scrolling Behaviour (WIP) #22
Conversation
That's great! I'm not very familiar with CM, so if you can help optimize it, that would be fantastic. Of course, your method will certainly be better than my use of padding-top. Thank you so much for your work, and I'm really looking forward to your optimized version. |
@zhouhua I've made some progress, and have gotten it working where it appends the headers at the correct position, however I'm struggling to get it accurately to scroll back to the position of the header minus the sticky heading element as it changes height along the way—I see why you did it the way you did it. If you can run and take a look at my code, specifically in the header onclick, maybe your fresh set of eyes might have an idea? At the end of the day, I think it's just timing of calculating the new sticky header height and when to apply that offset, for example, clicking on a header when sticky header has 2 elements, and arriving at a header that had 5 now in the header, how do we best handle this (your previous way makes total sense). However, you'll see there's no document reflow going on anymore which is great, but it's just that last little bit. No rush, when you get some time. Side note: if you test out |
@itsonlyjames I have observed some interesting phenomena.
|
@zhouhua great insights, I appreciate the knowledge.
I think extrapolating out some of the logic, into separate functions might be best. Plus for future development, having smaller functions might give us an easier time to debug. This might take a while, given we're both busy. Are you able to pull this branch from my repo and contribute to this PR also? Or can you pull this PR locally in your repo so you may contribute? I think it is going to take both of our brains to get a proper solid, performant solution in place. I look forward to the challenge! |
A quick question: how do we contribute code to the same branch? Do you have any recommended collaboration methods? |
I would suggest branching off and PR to merge back in if it's a big enough change, e.g., a complete refactor. Otherwise we're working on the same thing so I don't mind fixing a couple merge conflicts. If you want to take this branch and create your own within your repo I'd be happy to become a collaborator and work alongside you. |
I haven't done much open-source work before, so I lack experience. I've invited you to my repo as a collaborator; I think this will make things more convenient. |
I've copied your branch to my repo. I will close this PR, and we can continue this work in #23. |
Opening this in an attempt to fix a few issues:
Fixes: #21
Fixes: #20
I think we can utilise a bit more of the codeMirror functionality in getting the content position, thus being able to remove the padding top solution that is current.
Also includes a few minor code cleanings.
Needs a fair bit of work, but I think this could be great. I'll also implement a setting for the scroll behavior either
"instant"
or"smooth"
.Keen to see what you think and if it sparks any ideas!