Skip to content

[refactor] remove dependendy of cell navigation upon scrolling context#419

Merged
severo merged 3 commits intomasterfrom
alternate-jump-to-row
Feb 5, 2026
Merged

[refactor] remove dependendy of cell navigation upon scrolling context#419
severo merged 3 commits intomasterfrom
alternate-jump-to-row

Conversation

@severo
Copy link
Copy Markdown
Contributor

@severo 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

Copy link
Copy Markdown
Contributor

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 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: CellNavigationProvider now wraps ScrollProvider instead of vice versa, with ScrollProvider observing cell position changes
  • Removed isScrollingProgrammatically state from scroll management, simplifying the scroll state machine
  • Refactored cell navigation to use useInputState hook with notifyChange callback for better state management
  • Renamed Cell interface to CellPosition and 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 getScrollActionForRow from 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.

Comment thread src/contexts/CellNavigationContext.ts
Comment thread src/helpers/scroll.ts
Comment thread src/providers/CellNavigationProvider.tsx Outdated
Comment thread src/providers/CellNavigationProvider.tsx Outdated
@severo severo merged commit 6522b37 into master Feb 5, 2026
5 checks passed
@severo severo deleted the alternate-jump-to-row branch February 5, 2026 14:51
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