Skip to content

Commit

Permalink
sub
Browse files Browse the repository at this point in the history
scroll fix
  • Loading branch information
Weedshaker committed Aug 17, 2024
1 parent 7d85a6c commit 2805f73
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/es/Environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ self.Environment = {
language: currentScriptUrl.searchParams.get('language') || document.documentElement.getAttribute('lang') || 'en',
stage: currentScriptUrl.searchParams.get('stage') || document.documentElement.getAttribute('stage') || 'alpha',
keepAlive: 86400000,
version: currentScriptUrl.searchParams.get('version') || document.documentElement.getAttribute('version') || '4.2.13', // https://semver.org/
version: currentScriptUrl.searchParams.get('version') || document.documentElement.getAttribute('version') || '4.2.14', // https://semver.org/
/**
* Get custom mobile breakpoint
* @param {{constructor?: string, tagName?: string, namespace?: string}} organism
Expand Down
2 changes: 1 addition & 1 deletion src/es/chat
24 changes: 17 additions & 7 deletions src/es/components/organisms/body/Body.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ export default class Body extends Shadow() {
} else {
this.removeAttribute('is-scrolled-bottom')
}
}, 200)
this.dispatchEvent(new CustomEvent('merge-active-room', {
detail: {
scrollTop: this.main.scrollTop
},
bubbles: true,
cancelable: true,
composed: true
}))
}, 400)
}
this.mainScrollEventListener = event => {
const options = {}
Expand All @@ -51,20 +59,22 @@ export default class Body extends Shadow() {
if (this.shouldRenderCSS()) showPromises.push(this.renderCSS())
if (this.shouldRenderHTML()) showPromises.push(this.renderHTML())
Promise.all(showPromises).then(() => (this.hidden = false))
this.main.addEventListener('scroll', this.scrollEventListener)
this.globalEventTarget.addEventListener('main-scroll', this.mainScrollEventListener)
this.globalEventTarget.addEventListener('scroll-icon-show-event', this.scrollIconShowEventListener)
if (this.aScroll) {
this.main.addEventListener('scroll', this.scrollEventListener)
this.globalEventTarget.addEventListener('scroll-icon-show-event', this.scrollIconShowEventListener)
this.setAttribute('is-scrolled-bottom', '')
this.aScroll.addEventListener('click', this.aScrollClickEventListener)
}
}

disconnectedCallback () {
this.main.removeEventListener('scroll', this.scrollEventListener)
this.globalEventTarget.removeEventListener('main-scroll', this.mainScrollEventListener)
this.globalEventTarget.removeEventListener('scroll-icon-show-event', this.scrollIconShowEventListener)
if (this.aScroll) this.aScroll.removeEventListener('click', this.aScrollClickEventListener)
if (this.aScroll) {
this.main.removeEventListener('scroll', this.scrollEventListener)
this.globalEventTarget.removeEventListener('scroll-icon-show-event', this.scrollIconShowEventListener)
this.aScroll.removeEventListener('click', this.aScrollClickEventListener)
}
}

/**
Expand Down Expand Up @@ -157,7 +167,7 @@ export default class Body extends Shadow() {
opacity: 0.8;
transition: opacity 0.3s ease-out;
}
:host([is-scrolled-bottom]:not([scroll-icon-only-show-on-event])) > a-scroll, :host([scroll-icon-only-show-on-event]:not([scroll-icon-has-show-event])) > a-scroll {
:host([is-scrolled-bottom]) > a-scroll, :host([scroll-icon-only-show-on-event]:not([scroll-icon-has-show-event])) > a-scroll {
opacity: 0;
pointer-events: none;
}
Expand Down

0 comments on commit 2805f73

Please sign in to comment.