Skip to content

fix: find Grid header, footer and editor components - #203

Open
totally-not-ai[bot] wants to merge 1 commit into
mainfrom
fix/find-grid-header-footer-editor-components
Open

fix: find Grid header, footer and editor components#203
totally-not-ai[bot] wants to merge 1 commit into
mainfrom
fix/find-grid-header-footer-editor-components

Conversation

@totally-not-ai

@totally-not-ai totally-not-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Components you set as a Grid column header, footer or editor could not be found by find(...). They are now part of the component tree, so lookups work again.

Fixes #199

What changed

The Grid branch of TestingLifecycleHook.getAllChildren() was left commented out. The Grid.Column and ColumnGroup branches skip virtual children on purpose, so that a component in a merged cell is not reported once per spanned column. With the Grid branch disabled, nobody reported those components at all and they were missing from the tree.

The Grid branch is now enabled. It collects the header cell components, footer cell components and column editor components once per Grid, on top of the normal child traversal. Duplicates are removed, so a component in a merged cell is still reported exactly once. Comments in the Grid.Column and ColumnGroup branches now point to the Grid branch instead of the old, wrong explanation.

Test summary

# Status What the test verifies Why it matters
1 A component set with Column.setHeader(Component) is found by find(Button.class) The main bug: header components were invisible to lookups
2 A component set with Column.setFooter(Component) is found Same bug for footers
3 A component set with Column.setEditorComponent(Component) is found Editor components were invisible too, so editor tests could not click them
4 With one header, one footer and one editor component, find(Button.class).all() returns exactly 3 Guards against the old duplication problem coming back
5 A component in a header cell joined over two columns is returned exactly once The reason the Column branch drops virtual children; a regression here would break _get() with "found 2 matches"
  • GridSlotTraversalTest.columnComponents_headerFooterAndEditor_allLocatable — rows 1, 2, 3, 4
  • GridSlotTraversalTest.mergedHeaderCellComponent_reportedOnce — row 5

Deliberately untested: multi-row headers and footers beyond the joined-cell case, and the plain child traversal of a Grid, which is already covered by the existing lookup tests.

Grid column header/footer components are virtual children of the Column
(or ColumnGroup) that owns them, and both of those branches of
getAllChildren() drop virtual children on purpose so that a component in
a merged cell is not reported once per spanned column. The Grid branch
that was meant to report them instead was left commented out, so those
components were dropped from the component tree altogether and find()
never returned them. The same applied to column editor components.

Enable the Grid branch, collecting header cell, footer cell and editor
components once per Grid on top of the regular child traversal.

Fixes #199
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.

Hackathon 25.3: Browserless find() cannot see a component handed to another component

0 participants