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

Unable to set custom "boundary" to define scrolling container for the library scroll-into-view-if-needed #4590

Open
fredure opened this issue Oct 11, 2021 · 2 comments
Labels

Comments

@fredure
Copy link

fredure commented Oct 11, 2021

Problem
At the moment, the editor itself should be a scroll container. But if the scroll container needs to be above the editor, the scrolling logic will break.

Solution
I suggest adding an prop for the editor:


scrollIntoView(leafEl, {

slate-react:

scrollIntoView(leafEl, {
      scrollMode: 'if-needed',
      boundary: props.scrollBoundary || el
});

custom code:

const resolveScrollBoundary = (parent) => {
      return return !parent.classList.contains('.someClassName');
};

//...

<SlateEditable
      scrollBoundary={this.resolveScrollBoundary}
/>
@max-sym
Copy link

max-sym commented Oct 12, 2021

What do you mean exactly by "the scrolling logic will break" here?

For me, it scrolls the <html /> tag instead of my scrolling div.

@max-sym
Copy link

max-sym commented Oct 12, 2021

Similar thread in the scroll-into-view-if-needed repo: scroll-into-view/scroll-into-view-if-needed#635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants