Skip to content

fix: Scroll GridList to focused drop indicators - #10437

Open
mvanhorn wants to merge 3 commits into
adobe:mainfrom
mvanhorn:fix/6492-gridlist-drop-indicator-scroll
Open

fix: Scroll GridList to focused drop indicators#10437
mvanhorn wants to merge 3 commits into
adobe:mainfrom
mvanhorn:fix/6492-gridlist-drop-indicator-scroll

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Closes

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Give the rendered GridListDropIndicator row a relative default position so its visually hidden, absolutely positioned focus target is anchored at the indicator's location in the collection; follow the equivalent positioning pattern already used by TreeDropIndicator. Keep the change inside the existing render-props/default-style path so consumer-provided styles continue to compose normally and no new helper or API surface is introduced. Add a real-browser regression in the existing GridList browser suite because jsdom cannot validate native focus-driven scrolling: render a reorderable list taller than a constrained scrollport, start keyboard dragging, navigate to an initially off-screen drop target, and verify both focus and the scroll offset.

Closes #6492

🧢 Your Project:

Not applicable to this change.

@snowystinger

Copy link
Copy Markdown
Member

Looks like the PR is failing lint and the browser tests. As a reminder to your AI, you can run the browser tests with yarn test:browser

mvanhorn and others added 3 commits August 13, 2026 11:45
Addressed the remaining lint failure in [GridList.browser.test.tsx](/Users/mvanhorn/.osc/workspaces/adobe-react-spectrum-pr10437/packages/react-aria-components/test/GridList.browser.test.tsx:18) by wrapping programmatic focus in React’s `act()`.
=== CODEX STATUS ===
STATUS: PASS_WITH_ENV_BLOCKED
CHANGES:
- 1 file changed, 2 insertions, 2 deletions.
- No upstream files materialized and no rebase attempted.
VERIFICATION:
- PASS: `yarn lint`
@mvanhorn
mvanhorn force-pushed the fix/6492-gridlist-drop-indicator-scroll branch 2 times, most recently from df4d27d to 0621269 Compare August 13, 2026 18:45
@mvanhorn

Copy link
Copy Markdown
Contributor Author

Fixed the lint failure by wrapping the programmatic focus in act() in GridList.browser.test.tsx. Also rebased onto current main since the branch had fallen behind.

yarn lint passes now and the GridList Jest suite is green at 93 tests. I could not run yarn test:browser locally because my sandbox blocks localhost listeners, so that one is on CI.

@snowystinger

Copy link
Copy Markdown
Member

If you are unable to see the browser test error, here it is


 FAIL   chromium-desktop  packages/react-aria-components/test/GridList.browser.test.tsx > scrolls focused drop indicators into view during keyboard reordering
TypeError: Cannot read properties of null (reading 'focus')

Failure screenshot:
  - packages/react-aria-components/test/__screenshots__/GridList.browser.test.tsx/scrolls-focused-drop-indicators-into-view-during-keyboard-reordering-1.png

 ❯ packages/react-aria-components/test/GridList.browser.test.tsx:158:23
    156|   let gridlist = container.querySelector('[role=grid]') as HTMLElement;
    157|   let dragButton = container.querySelector('[aria-label="Drag Item 0"]…
    158|   act(() => dragButton.focus());
       |                       ^
    159| 
    160|   await userEvent.keyboard('{Enter}');
 ❯ packages/react-aria-components/test/GridList.browser.test.tsx:158:2

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/3]⎯

 FAIL   firefox-desktop  packages/react-aria-components/test/GridList.browser.test.tsx > scrolls focused drop indicators into view during keyboard reordering
TypeError: can't access property "focus", dragButton is null

Failure screenshot:
  - packages/react-aria-components/test/__screenshots__/GridList.browser.test.tsx/scrolls-focused-drop-indicators-into-view-during-keyboard-reordering-1.png

 ❯ packages/react-aria-components/test/GridList.browser.test.tsx:158:12
    156|   let gridlist = container.querySelector('[role=grid]') as HTMLElement;
    157|   let dragButton = container.querySelector('[aria-label="Drag Item 0"]…
    158|   act(() => dragButton.focus());
       |            ^
    159| 
    160|   await userEvent.keyboard('{Enter}');
 ❯ packages/react-aria-components/test/GridList.browser.test.tsx:158:6

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/3]⎯

 FAIL   webkit-desktop  packages/react-aria-components/test/GridList.browser.test.tsx > scrolls focused drop indicators into view during keyboard reordering
TypeError: null is not an object (evaluating 'dragButton.focus')

Failure screenshot:
  - packages/react-aria-components/test/__screenshots__/GridList.browser.test.tsx/scrolls-focused-drop-indicators-into-view-during-keyboard-reordering-1.png

 ❯ packages/react-aria-components/test/GridList.browser.test.tsx:158:23
    156|   let gridlist = container.querySelector('[role=grid]') as HTMLElement;
    157|   let dragButton = container.querySelector('[aria-label="Drag Item 0"]…
    158|   act(() => dragButton.focus());
       |                       ^
    159| 
    160|   await userEvent.keyboard('{Enter}');
 ❯ packages/react-aria-components/test/GridList.browser.test.tsx:158:6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scroll issue when using keyboard in a fix height list

2 participants