Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/bundle/Resources/public/js/scripts/admin.back.to.top.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

return backToTopBtn.classList.contains('ibexa-back-to-top__btn--visible');
};
const backToTopBtnTitle = backToTopBtn.querySelector('.ibexa-back-to-top__title');
let currentBackToTopAnchorHeight = backToTopAnchor.offsetHeight;
const setBackToTopBtnTextVisibility = (container) => {
const isTitleVisible = Math.abs(container.scrollHeight - container.scrollTop - container.clientHeight) <= 2;
const setBackToTopBtnVisibility = (container) => {
const shouldBeVisible = container.scrollTop !== 0;

if (backToTopBtn.classList.contains('ibexa-back-to-top__btn--visible') && !shouldBeVisible) {
Expand All @@ -29,15 +27,12 @@
backToTopBtn.classList.add('ibexa-back-to-top__btn--visible');
ibexa.quickAction.recalculateButtonsLayout();
}

backToTopBtn.classList.toggle('ibexa-btn--no-text', !isTitleVisible);
backToTopBtnTitle.classList.toggle('ibexa-back-to-top__title--visible', isTitleVisible);
};

backToTopScrollContainer.addEventListener('scroll', (event) => {
const container = event.target;

setBackToTopBtnTextVisibility(container);
setBackToTopBtnVisibility(container);
});
backToTopBtn.addEventListener('click', () => {
backToTopAnchor.scrollIntoView({
Expand All @@ -52,7 +47,7 @@

currentBackToTopAnchorHeight = entries[0].target.clientHeight;

setBackToTopBtnTextVisibility(backToTopScrollContainer);
setBackToTopBtnVisibility(backToTopScrollContainer);
});
const config = {
id: 'back-to-top',
Expand Down
10 changes: 6 additions & 4 deletions src/bundle/Resources/public/scss/_back-to-top.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
transition: opacity $ibexa-admin-transition-duration $ibexa-admin-transition;
box-shadow: $ibexa-edit-header-box-shadow;

&:hover {
.ibexa-back-to-top__title {
display: inline-block;
}
}

&--visible {
opacity: 1;
visibility: visible;
Expand All @@ -22,10 +28,6 @@
&__title {
display: none;
padding-right: calculateRem(8px);

&--visible {
display: inline-block;
}
}

&__icon.ibexa-icon {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Behat/Component/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function clickNextButton(): void
JS);
$this->getHTMLPage()
->setTimeout(3)
->findAll(new VisibleCSSLocator('backToTopWithTitle', '.ibexa-back-to-top__title--visible'));
->findAll(new VisibleCSSLocator('backToTopBtn', '.ibexa-back-to-top__btn--visible'));
$this->getHTMLPage()->find($this->getLocator('nextButton'))->click();
$this->getHTMLPage()->setTimeout(10)->waitUntil(function () use ($currentPage) {
$activePge = (int) $this->getHTMLPage()->find($this->getLocator('currentPage'))->getText();
Expand Down
Loading