Skip to content

Commit

Permalink
fix: scroll into view default options unreasonable sometime (#49)
Browse files Browse the repository at this point in the history
* fix: scroll into view default options lead to scroll behaviour strange

* make default scroll into view options
  • Loading branch information
ANUGLYPLUGIN authored Jan 20, 2024
1 parent abbfe9c commit d815fa7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Tour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const CENTER_PLACEHOLDER: React.CSSProperties = {
width: 1,
height: 1,
};
const defaultScrollIntoViewOptions: ScrollIntoViewOptions = {
block: "center",
inline: "center"
}

export interface TourProps
extends Pick<TriggerProps, 'onPopupAlign'> {
Expand Down Expand Up @@ -72,7 +76,7 @@ const Tour: React.FC<TourProps> = props => {
renderPanel,
gap,
animated,
scrollIntoViewOptions = true,
scrollIntoViewOptions = defaultScrollIntoViewOptions,
zIndex = 1001,
closeIcon,
builtinPlacements,
Expand Down Expand Up @@ -111,7 +115,7 @@ const Tour: React.FC<TourProps> = props => {
arrow: stepArrow,
className: stepClassName,
mask: stepMask,
scrollIntoViewOptions: stepScrollIntoViewOptions,
scrollIntoViewOptions: stepScrollIntoViewOptions = defaultScrollIntoViewOptions,
closeIcon: stepCloseIcon,
} = steps[mergedCurrent] || {};

Expand Down

1 comment on commit d815fa7

@vercel
Copy link

@vercel vercel bot commented on d815fa7 Jan 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.