fix(memory-graph): center arrow-key navigation in the visible graph area#1337
Open
abhay-codes07 wants to merge 1 commit into
Open
fix(memory-graph): center arrow-key navigation in the visible graph area#1337abhay-codes07 wants to merge 1 commit into
abhay-codes07 wants to merge 1 commit into
Conversation
selectAndCenter passed the full containerSize.height to viewport.centerOn, while every other navigation action (auto-fit, center, zoom) uses graphFitHeight, which on compact viewports subtracts the space taken by the bottom controls. centerOn places the target at height/2, so keyboard navigation dropped the selected node at the midpoint of the whole container, partly behind the bottom control bar on mobile, instead of the midpoint of the visible graph area like the center button does. Use graphFitHeight so arrow-key selection lands where the other centering paths already do.
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.
Problem
viewport.centerOn(worldX, worldY, width, height)positions the target point atheight / 2on screen:The component derives a separate
graphFitHeightthat, on compact viewports, reserves room for the bottom control bar:Auto-fit, the center button, and the zoom controls all pass
graphFitHeight, so they place content in the middle of the visible graph area. ButselectAndCenter(arrow-key node navigation) passed the fullcontainerSize.height:So on mobile, stepping through nodes with the keyboard centers the selected node at the midpoint of the whole container, which puts it partly behind the bottom controls, while the dedicated center button drops the same graph correctly above them.
Fix
Pass
graphFitHeight(and depend on it) soselectAndCenterlands the node where the other centering paths already do:On desktop
graphFitHeight === containerSize.height, so nothing changes there. Full memory-graph suite (188 tests) passes andtsc --noEmitis clean.