-
Notifications
You must be signed in to change notification settings - Fork 597
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
chore: update to dim bg when page scrolls beyond hero #3333
Conversation
setupFadeObserver() { | ||
const observer = new IntersectionObserver( | ||
entries => { | ||
entries.forEach(entry => (this.faded = !entry.isIntersecting)); | ||
}, | ||
{ threshold: [0.5] } | ||
); | ||
|
||
const heroSection: HTMLElement = document.getElementById("hero") as HTMLElement; | ||
|
||
observer.observe(heroSection); |
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.
🎉
{ threshold: [0.5] } | ||
); | ||
|
||
const heroSection: HTMLElement = document.getElementById("hero") 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.
I don't have a good proposal, but curious if there are any issue with referencing this (assuming it's in another elements shadow DOM?)...
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's actually an element in the actual DOM. Since the background itself doesn't scroll, we need to observe something that does.
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.
party, if it's in the light dom we are good 👍
3c1bb9e
to
16bcb7f
Compare
const observer = new IntersectionObserver( | ||
entries => { | ||
entries.forEach(entry => { | ||
this.faded = entry.intersectionRatio < 0.5; |
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.
Nice.
16bcb7f
to
46ff18c
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.
I ran your branch and it looks awesome!
Description
This change dims the background when the page is scrolled past the hero.
Motivation & context
To aid visual accessibility, the background needs to provide better contrast when behind the page content.
Issue type checklist
Is this a breaking change?
Adding or modifying component(s) in
@microsoft/fast-components
checklistProcess & policy checklist