Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enhancing User Experience with Smooth Scrolling 📜 #729

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
sanjaiyan-dev wants to merge 8 commits into swiftlang:main
base: main
Choose a base branch
Loading
from sanjaiyan-dev:sanjaiyan-improve-css

Conversation

@sanjaiyan-dev
Copy link
Contributor

@sanjaiyan-dev sanjaiyan-dev commented Sep 12, 2023

This PR adds scroll-behavior: smooth to provide a smoother and more user-friendly scrolling experience, enhancing navigation, aesthetics, and engagement while maintaining compatibility with modern browsers.

Extremely sorry, if I made any mistakes :(

lin72h and sanjaiyan-dev reacted with eyes emoji
Copy link
Contributor

@mportiz08 mportiz08 left a comment

Choose a reason for hiding this comment

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

Unfortunately, I'm finding that this change has a negative impact on the experience of scrolling to linked subsections within example article content.

Example:

sanjaiyan-improve-css.mov

Notice how the page is no longer scrolling so that the linked subsection appears at the top of the page (under the nav bar).

You can compare this with the expected behavior on main:

main.mov

I'm not sure why this is happening with your simple change, but there must be something with our usage of the scrolling APIs that is messing with the timing/location or something when combined with this CSS addition.

If you're able to resolve this, I'd be happy to re-consider this change—smooth scrolling in general sounds like a good addition if we can get it working properly. Thanks for the contribution!

Copy link
Contributor Author

Unfortunately, I'm finding that this change has a negative impact on the experience of scrolling to linked subsections within example article content.

Example:

sanjaiyan-improve-css.mov

Notice how the page is no longer scrolling so that the linked subsection appears at the top of the page (under the nav bar).

You can compare this with the expected behavior on main:

main.mov

I'm not sure why this is happening with your simple change, but there must be something with our usage of the scrolling APIs that is messing with the timing/location or something when combined with this CSS addition.

If you're able to resolve this, I'd be happy to re-consider this change—smooth scrolling in general sounds like a good addition if we can get it working properly. Thanks for the contribution!

Sorry, I will try to resolve this issue (not sure) 🤞🏽

mportiz08 reacted with heart emoji

Copy link
Contributor Author

Unfortunately, I'm finding that this change has a negative impact on the experience of scrolling to linked subsections within example article content.

Example:

sanjaiyan-improve-css.mov
Notice how the page is no longer scrolling so that the linked subsection appears at the top of the page (under the nav bar).

You can compare this with the expected behavior on main:

main.mov
I'm not sure why this is happening with your simple change, but there must be something with our usage of the scrolling APIs that is messing with the timing/location or something when combined with this CSS addition.

If you're able to resolve this, I'd be happy to re-consider this change—smooth scrolling in general sounds like a good addition if we can get it working properly. Thanks for the contribution!

Hi, I tried to implement the smooth scrolling using JavsScript, hope it works 🤞🏽

mportiz08 reacted with thumbs up emoji

Copy link
Contributor

@mportiz08 mportiz08 left a comment

Choose a reason for hiding this comment

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

Nice—seems to be working now!

There are a number of failing unit tests to look into now, but I think you should be able to easily update them based on the changes you made. You can see them with npm test.

sanjaiyan-dev reacted with thumbs up emoji
Copy link
Contributor

@dobromir-hristov dobromir-hristov left a comment

Choose a reason for hiding this comment

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

On Chrome this is not behaving well at all.

In general, have to do a refactor on the way we handle scrolling. We sometimes call a scroll and then after a frame or two nudge by an extra few pixels to compensate for the sticky navbar for example. This is not visible when instant scrolling, but very much so when smooth scrolling.

This causes jumping and stuttering, especially on Chrome which is not OK.

Things I tried:

  1. Clicking on headings
  2. Refreshing after clicking the headings
  3. Clicking on items in the OnThisPage right floating nav

sanjaiyan-dev reacted with thumbs up emoji
Copy link
Contributor Author

On Chrome this is not behaving well at all.

In general, have to do a refactor on the way we handle scrolling. We sometimes call a scroll and then after a frame or two nudge by an extra few pixels to compensate for the sticky navbar for example. This is not visible when instant scrolling, but very much so when smooth scrolling.

This causes jumping and stuttering, especially on Chrome which is not OK.

Things I tried:

  1. Clicking on headings
  2. Refreshing after clicking the headings
  3. Clicking on items in the OnThisPage right floating nav

Hi @dobromir-hristov , I made the your suggested changes :) , Hope it works correctly now !

Copy link
Contributor

Hi @dobromir-hristov , I made the your suggested changes :) , Hope it works correctly now !

Yes those are better, yet my last point still stands. When you land on a page with an anchor it does not smoothly scroll to that part of the page, but rather it starts jumping up/down.

Here is an example:

Screen.Recording.2023年09月18日.at.14.19.58.mov

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

Reviewers

@mportiz08 mportiz08 mportiz08 requested changes

@dobromir-hristov dobromir-hristov Awaiting requested review from dobromir-hristov

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /