Skip to content

Add ability to set scroll behavior when calling ref.scrollTo #1004

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

Merged
merged 5 commits into from
Jun 18, 2025

Conversation

Tintef
Copy link
Contributor

@Tintef Tintef commented Nov 5, 2024

feature/scroll-behavior

What?

  • Accept behavior as part of the options object when calling scrollTo method
  • Accept behavior when calling appendRow

Why?

So we can have a smooth transition when programmatically adding a row or scrolling to a given cell.

The current way to do this, as far as I know, is adding a class with scroll-behavior: smooth to the editor, which causes arrow navigation to also have the smooth behavior which feels awful :/

@lukasmasuch lukasmasuch requested a review from Copilot June 16, 2025 23:36
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for configurable scroll behavior by introducing a new "behavior" parameter to both the scrollTo and appendRow methods, allowing for smoother transitions when scrolling or appending rows.

  • Added an optional "behavior" property to the ImperativeScrollProps interface and updated the examples to demonstrate its usage.
  • Modified the DataEditor component to support the new behavior parameter in scrollTo and appendRow methods.
  • Updated the API documentation to reflect the new method signatures with behavior options.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/core/src/docs/examples/imperative-scroll.stories.tsx Updated interface and examples to include the new behavior property for scrolling.
packages/core/src/data-editor/data-editor.tsx Modified scrollTo and appendRow functions to accept and propagate the behavior parameter.
packages/core/API.md Revised API documentation to show updated method signatures with behavior options.

@lukasmasuch lukasmasuch changed the title feature/scroll-behavior: add ability to set scroll behavior when calling ref.scrollTo Add ability to set scroll behavior when calling ref.scrollTo Jun 18, 2025
Copy link
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@lukasmasuch lukasmasuch merged commit f7ca2e8 into glideapps:main Jun 18, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants