Fix scrolling through the download dropdown (#2425)

* Fix scrolling through the download dropdown

* Fix lining issue
This commit is contained in:
absidue 2022-07-31 16:09:12 +02:00 committed by GitHub
parent 7ec1c1eb05
commit 651e95f7a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 3 deletions

View File

@ -292,6 +292,18 @@ export default Vue.extend({
}
]
})
this.$watch('$refs.downloadButton.dropdownShown', (dropdownShown) => {
this.$parent.infoAreaSticky = !dropdownShown
if (dropdownShown && window.innerWidth >= 901) {
// adds a slight delay so we know that the dropdown has shown up
// and won't mess up our scrolling
Promise.resolve().then(() => {
this.$parent.$refs.infoArea.scrollIntoView()
})
}
})
}
},
methods: {

View File

@ -95,6 +95,7 @@
/>
<ft-icon-button
v-if="!isUpcoming && downloadLinks.length > 0"
ref="downloadButton"
:title="$t('Video.Download Video')"
class="option"
theme="secondary"

View File

@ -76,7 +76,8 @@ export default Vue.extend({
timestamp: null,
playNextTimeout: null,
playNextCountDownIntervalId: null,
pictureInPictureButtonInverval: null
pictureInPictureButtonInverval: null,
infoAreaSticky: true
}
},
computed: {

View File

@ -68,7 +68,11 @@
grid-area: info
position: relative
@media only screen and (min-width: 901px)
@media only screen and (min-width: 901px)
.infoArea
scroll-margin-top: 76px
.infoAreaSticky
position: sticky
top: 76px

View File

@ -64,7 +64,11 @@
</div>
</div>
</div>
<div class="infoArea">
<div
ref="infoArea"
class="infoArea"
:class="{ infoAreaSticky }"
>
<watch-video-info
v-if="!isLoading"
:id="videoId"