-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
scroll to top functionality #5620
base: main
Are you sure you want to change the base?
scroll to top functionality #5620
Conversation
596ed56
to
3348c39
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. See some comments
c1daa1a
to
2a306b2
Compare
Successfully ran npm run check:format. |
assets/scss/_registry.scss
Outdated
|
||
// Scroll-to-top button styling | ||
.scroll-container { | ||
text-align: center; | ||
margin-top: 20px; | ||
} | ||
|
||
.scroll-btn { | ||
background-color: #007bff; | ||
color: white; | ||
bottom: 40px; | ||
right: 40px; | ||
display: none; | ||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); | ||
z-index: 1000; | ||
border-radius: 50%; | ||
position: fixed; | ||
} |
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.
Since these styles are no longer confined to the registry, they should be moved. I think that it's fine to move it to the end of assets/scss/_styles_project.scss
.
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.
Done. @chalin
layouts/partials/hooks/body-end.html
Outdated
@@ -2,3 +2,48 @@ | |||
{{ partial "script.html" (dict "src" "js/tracing.js") -}} | |||
{{ end -}} | |||
{{ partial "script.html" (dict "src" "js/navScroll.js") -}} | |||
|
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.
Move all of this extra content into it's own partial, say layouts/partials/scroll-to-top.html
.
As for the JS, and I think I mentioned this before, do the following:
- Move the JS into its own file, say,
assets/js/scrollToTop.js
- Use
layouts/partials/script.html
to bring in the script content.
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.
But @svrnm said i handle this differently already
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.
@bintus-ux can you give more details on your concerns on @chalin's requests? To me they sound like a further improvement on what we have so far.
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.
Yeah all he just suggested was what i did initially already, i had the scrollToTop.js file in the js folder but you suggested i implement the javascript code on the body-end.html file that way getting rid of the scrollToTop.js file seeing as it was no longer needed, but i am confused now @svrnm
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.
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.
@bintus-ux no worries, everyone of us is misreading things from time to time and from own experience I know that beign a non-native english speaker adds an additional source of potential misunderstanding, that's why it is always good to ask more questions!
I hope you feel better now!
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 so much for the words mentor, and yes i'm recuperating fast!
…s/scss/_styles_project.scss
…roll-to-top.html and scrollToTop.js file'
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 think it should be hidden in mobile resolutions (using a CSS media declaration to set it it display:none; if width is lower than n pixels)
Also, NN recommends to add a text label, too, and make it appear only after 3 or 4 page scrolls https://www.nngroup.com/articles/back-to-top/
Well noted, on it |
In this update, I hid the "Top" label text on mobile devices using a CSS media query that sets it to display: none when the screen width is below a specified pixel value (e.g., 768px). Additionally, I implemented functionality where the scroll-to-top button disappears after 2-3 seconds of inactivity, as per your feedback. I also made the text label appear only after the user has scrolled 3-4 pages, following NN's recommendation for improved usability. I would appreciate the team's review please. @svrnm @chalin @theletterf |
@bintus-ux thanks! A few observations using the preview @ https://deploy-preview-5620--opentelemetry.netlify.app/
|
Indeed I initially used the text “Go to top” but it appeared crowded so I improvised |
Top similar to the up arrow might not be conclusive to every user, that's why there is the recommendation to go with "Back to Top" |
Indeed it doesn’t come up for mobile as I was
yes indeed I’m on it |
Good day @svrnm , I’ve been trying to except / using the check {{ if not .IsHome }} |
First of all that's actually a good way to fix that. Let's see if we can get this working (with this or any other check). Can you push the code changes so we can take a look as well? Thx |
Gotcha, on it. |
@svrnm i managed to use JavaScript to restrict displaying the scroll to top button on the home page, also updated the UI of the button and now make use of the text “Back to Top” which comes up on 3-4 scrolls and as well comes up on mobile, please do give a look mentor! |
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! some inline comments.
Also can you run npm run fix:all
locally, you have some files changed and some submodules updated that shouldn't be there, this should help with that
// Hide the button after 2-3 seconds of inactivity | ||
hideTimeout = setTimeout(() => { | ||
scrollToTopBtn.classList.remove("visible"); | ||
}, 2500); |
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.
}, 2500); | |
}, 5000); |
For me 2.5 seconds is to early, I suggest 5 or even more seconds for the timeout
&:hover { | ||
background-color: #f1f1f1; | ||
border: 2px solid #007bff; | ||
border-top-right-radius: 20px; | ||
border-bottom-left-radius: 0; | ||
border-top-left-radius: 0; | ||
border-bottom-right-radius: 0; | ||
} |
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.
you might want to add a mode for dark mode as well
<div class="scroll-container"> | ||
<button id="scrollToTopBtn" class="scroll-btn btn" aria-label="Scroll to top" title="Scroll to top"> | ||
<i class="fas fa-chevron-up scroll-icon"></i> | ||
<span class="scroll-label">Back to Top</span> |
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.
this is never visible for me
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 comes up after 3 to 4 scrolls which is mostly for long content pages did you try such page, maybe the registry page? @svrnm
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.
what's the purpose of showing the arrow earlier than the text?
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.
For the sake of i18n, I'd drop the English label. I think that using an icon is clear enough. WDYT @svrnm?
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.
As pointed out by @theletterf i ought to only display the text after 3-4 page scrolls so I decided to only display the arrow until the page scroll triggers smoothly transitioning into view the label text? Or how do you suggest I go about it @svrnm
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.
having that label is an accessibility feature for me, not everyone might immediately understand the meaning of this button/we can not assume that since we understand it everyone does. And again, that's also why I dislike the 3-4 page scrolls until it shows up.
Although I have to admit I didn't think about the localized pages.
Since we have conflicting opinions between maintainers here, I suggest we do not over-engineer the problem for now and block @bintus-ux any longer, so let's do the following:
- Remove the "Back to top" label for now
- Raise a new issue that we want to have it added to the scroll to top functionality.
For me this would be good enough, wdyt? @chalin @theletterf
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.
Yes, good plan! 🙌🏻
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.
Btw, the need-of-rebase issue and one suggestion I made in #5620 (review) are still pending.
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.
Yea that sounds good, fixes will be done today, thanks again!
Alright I will get to the changes |
/fix:submodule |
You triggered fix:submodule action run at https://github.com/open-telemetry/opentelemetry.io/actions/runs/12187808976 |
fix:submodule failed or was cancelled. For details, see https://github.com/open-telemetry/opentelemetry.io/actions/runs/12187808976. |
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.
Hi @bintus-ux - thanks for the continued work on this PR. See inline comments.
<div class="scroll-container"> | ||
<button id="scrollToTopBtn" class="scroll-btn btn" aria-label="Scroll to top" title="Scroll to top"> | ||
<i class="fas fa-chevron-up scroll-icon"></i> | ||
<span class="scroll-label">Back to Top</span> |
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.
For the sake of i18n, I'd drop the English label. I think that using an icon is clear enough. WDYT @svrnm?
@@ -2,3 +2,5 @@ | |||
{{ partial "script.html" (dict "src" "js/tracing.js") -}} | |||
{{ end -}} | |||
{{ partial "script.html" (dict "src" "js/navScroll.js") -}} | |||
{{ partial "scroll-to-top.html" }} |
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.
{{ partial "scroll-to-top.html" }} | |
{{ partial "scroll-to-top.html" -}} |
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.
This submodule (content-modules/opentelemetry-java-examples
) should not be modified. You'll need:
- Pull down the latest
main
branch - Rebase your PR branch from the latest from
main
, and resolve any conflicts (as there are currently conflicts).
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.
Gotcha, on it mentor. Thanks
0ce766f
to
2b81dea
Compare
2b81dea
to
fdcd56b
Compare
fdcd56b
to
fa49f48
Compare
efed389
to
794e07b
Compare
I apologise for the inactivity this week,caught up with in real life activities as i recently lost my dad, but will try making the fixes onwards now. |
i think i broke a couple files on rushing to fix, maybe making a new PR with your suggested changes would not be bad @svrnm ? |
a new PR might be a good idea 👍 |
Yes. Please reference the new PR in this one before / while closing it. |
Overview
The Scroll to Top feature enhances the user experience by providing an intuitive way for users to quickly return to the top of the registry page. This is particularly useful for pages with extensive content or long scroll lengths, such as the OpenTelemetry registry page, where users frequently navigate through dense information.
Note: This implementation addresses the same functionality described in an earlier PR (issue number #5331) for the Scroll to Top feature. However, due to issues with submodules in the previous PR, I have created this new PR to ensure proper integration of the feature. The previous PR serves as a reference for the original implementation.