Skip to content
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

feat(botonic-react): Replace scroll behavior in scrollIntoView for a CSS property #2953

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions packages/botonic-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@botonic/react",
"version": "0.30.7",
"version": "0.30.8-alpha.1",
"license": "MIT",
"description": "Build Chatbots using React",
"main": "./lib/cjs",
Expand All @@ -20,7 +20,7 @@
"lint_core": "../../node_modules/.bin/eslint_d --cache --quiet '.*.js' '*.js' 'src/**/*.js*' --fix"
},
"dependencies": {
"@botonic/core": "^0.30.0",
"@botonic/core": "^0.30.2",
"axios": "^1.7.2",
"emoji-picker-react": "^4.4.9",
"lodash.merge": "^4.6.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import {
getWebchatElement,
} from '../../util/dom'

export const useScrollToBottom = ({
host,
behavior = 'smooth',
timeout = 200,
}) => {
export const useScrollToBottom = ({ host, timeout = 200 }) => {
const scrollToBottom = () => {
const webchatElement = getWebchatElement(host)
if (!webchatElement) return
Expand All @@ -17,7 +13,6 @@ export const useScrollToBottom = ({
setTimeout(() => {
scrollableMessagesListElement.scrollTo({
top: scrollableMessagesListElement.scrollHeight,
behavior: behavior as ScrollBehavior,
})
}, timeout)
}
Expand Down
2 changes: 0 additions & 2 deletions packages/botonic-react/src/webchat/message-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ import { useNotifications } from './use-notifications'

const SCROLL_TIMEOUT = 200
const scrollOptionsEnd: ScrollIntoViewOptions = {
behavior: 'smooth',
block: 'end',
}
const scrollOptionsCenter: ScrollIntoViewOptions = {
behavior: 'smooth',
block: 'center',
}

Expand Down
1 change: 1 addition & 0 deletions packages/botonic-react/src/webchat/message-list/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ export const ScrollableMessageList = styled.div`
overflow-y: auto;
overflow-x: hidden;
overscroll-behavior: contain; // https://css-tricks.com/almanac/properties/o/overscroll-behavior/
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
`
Loading