---
title: "Keep expanded detail attached to its record"
description: "Verify an expanded table row shows the correct detail and remains attached to that record when sorting changes its position."
canonical_url: "https://vostride.com/agent-library/data-tables/expanded-row-state.md"
md_url: "https://vostride.com/agent-library/data-tables/expanded-row-state.md"
content_kind: "recipe"
topic: "data-tables"
---

# Keep expanded detail attached to its record

Verify an expanded table row shows the correct detail and remains attached to that record when sorting changes its position.

## Risk

Expansion state keyed by row index can expose another record detail after sorting. Distinct child content and stable identifiers let the test detect this mismatch without relying on row position.

## Fixtures

- A test project table has Alpine and Coast with different names, counts, and prepared child-task labels.
- Alpine expands to child Alpine gate, while Coast expands to Coast briefing.
- The contract preserves expansion on the same record when sort changes, and both projects fit on one page.

## Steps

1. Open the project table sorted by name ascending and verify Alpine precedes Coast.
2. Expand Alpine and verify only Alpine gate appears within its expanded detail area.
3. Change name sort to descending and verify Coast now precedes Alpine.
4. Verify the expansion remains under Alpine and still shows Alpine gate, with no Coast briefing content inside it.
5. Collapse Alpine, expand Coast, and verify Coast briefing appears under Coast, then reload to check the documented expansion reset or persistence behavior.

## Expected results

- The expanded detail belongs to the independently identified parent project.
- Reordering rows preserves the chosen parent association under the specified contract.
- Changing the expanded parent replaces both the detail region and its child content correctly.

## False-pass traps

- A detail panel remaining at the same screen location is not proof it stayed attached to the correct row.
- A generic child count could match both projects; inspect the distinctive child label and parent identity.

## Cleanup

- Delete the two project fixtures and their child tasks, then reset table sort and expansion state.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa first test](/docs/agent-qa/guides/first-test.md)
- [agent-qa web testing](/docs/agent-qa/guides/web-testing.md)

- [Data table QA recipes](/agent-library/data-tables.md)
- [Software factory QA library](/agent-library.md)
