[refactor] remove dependendy of cell navigation upon scrolling context#419
Merged
[refactor] remove dependendy of cell navigation upon scrolling context#419
Conversation
Contributor
severo
commented
Feb 5, 2026
- remove dependency of cell navigation upon scrolling context
- rely on useInputState and notifyChange, instead of simple state. It will be useful for expanding to controlled cell navigation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the cell navigation architecture to remove its dependency on the scrolling context. The refactoring improves separation of concerns by inverting the provider hierarchy and using the useInputState hook for better state management, paving the way for controlled cell navigation in the future.
Changes:
- Inverted provider hierarchy:
CellNavigationProvidernow wrapsScrollProviderinstead of vice versa, withScrollProviderobserving cell position changes - Removed
isScrollingProgrammaticallystate from scroll management, simplifying the scroll state machine - Refactored cell navigation to use
useInputStatehook withnotifyChangecallback for better state management - Renamed
Cellinterface toCellPositionand moved it to types.ts for better organization - Made navigation functions (
moveCell,goToFirstCell,goToCurrentCell,navigateToCell) optional to support disabled navigation scenarios - Changed error handling in
getScrollActionForRowfrom throwing errors to logging warnings - Updated all tests to reflect the removed state and renamed properties
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Adds new CellPosition interface with documentation |
| src/contexts/CellNavigationContext.ts | Renames Cell to CellPosition, updates context type to make functions optional, removes default no-op implementations |
| src/contexts/ScrollContext.ts | Removes scrollRowIntoView function and isScrollingProgrammatically property |
| src/providers/CellNavigationProvider.tsx | Major refactoring to use useInputState, implements bounds checking in useEffect, changes functions to use useMemo for stability |
| src/providers/ScrollProvider.tsx | Adds dependency on CellNavigationContext, implements scroll-on-cell-change via useEffect, removes scrollRowIntoView function |
| src/components/HighTable/HighTable.tsx | Inverts provider nesting order (CellNavigationProvider now wraps ScrollProvider) |
| src/components/HighTable/Slice.tsx | Updates keyboard navigation handler to use useMemo and handle optional moveCell |
| src/components/HighTable/Scroller.tsx | Updates to use renamed goToCurrentCell |
| src/components/Cell/Cell.tsx | Adds optional chaining for navigateToCell |
| src/components/ColumnHeader/ColumnHeader.tsx | Adds optional chaining for navigateToCell |
| src/components/ColumnMenu/ColumnMenu.tsx | Adds optional chaining for goToFirstCell with TODO comment |
| src/components/RowHeader/RowHeader.tsx | Adds optional chaining for navigateToCell |
| src/components/TableCorner/TableCorner.tsx | Adds optional chaining for navigateToCell |
| src/hooks/useCellFocus.ts | Updates to use cellPosition and makes navigateToCell optional using useMemo |
| src/hooks/useColumnMenu.ts | Makes navigateToCell parameter optional |
| src/helpers/scroll.ts | Removes isScrollingProgrammatically from state and actions, changes error to warning in getScrollActionForRow |
| test/providers/CellNavigationProvider.test.tsx | Updates tests for renamed property and optional chaining |
| test/helpers/scroll.test.ts | Removes all assertions related to isScrollingProgrammatically |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.