Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.

fix: expose disclosure trigger-to-panel semantics relationship - #97

Merged
leoafarias merged 6 commits into
mainfrom
fix/disclosure-semantics-relationship
Aug 21, 2026
Merged

leoafarias merged 6 commits into
mainfrom
fix/disclosure-semantics-relationship

Conversation

@leoafarias

@leoafarias leoafarias commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Description\n\nNakedDisclosure currently exposes expanded state but not the semantic relationship between its trigger and panel. This change gives each disclosure state a private, stable panel identifier and sets the trigger controlsNodes relationship only while expanded, matching the panel presence in the semantics tree.\n\nAfter reopening, the relationship is deferred until the remounted panel has registered in the semantics tree. This makes Flutter web resolve aria-controls to the recreated DOM semantics node instead of retaining a stale target or dropping the relationship because the target was not ready.\n\nNo public API is added or changed. Visible-label derivation, explicit label replacement, disabled behavior, keyboard interaction, focus restoration, and animated closing remain unchanged.\n\nThe disclosure accessibility documentation now describes the relationship lifecycle.\n\n## Related Issues\n\nNone. This is an upstream prerequisite for the Remix Disclosure integration.\n\n---\n\n## Checklist\n\n- [x] My PR includes unit or integration tests for all changed/updated/fixed behaviors.\n- [x] I have updated or added relevant documentation.\n- [x] I am prepared to follow up on review comments in a timely manner.\n\n## Breaking Change\n\n- [ ] Yes, this is a breaking change.\n- [x] No, this is not a breaking change.\n\n## Verification\n\n- dart format --set-exit-if-changed .\n- flutter analyze\n- flutter test packages/naked_ui/test\n- flutter test packages/example/test\n- flutter pub publish --dry-run (0 warnings)\n- Remix Widgetbook on Flutter web using this branch: initial aria-controls target exists, Enter collapse removes the relationship, and Space reopen resolves to the recreated panel.

@github-actions

Copy link
Copy Markdown
Contributor

LCOV of commit d69aec2 during Flutter CI #304

	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
Reading tracefile /tmp/__zgosalvez_github-actions-report-lcov/lcov.info.
Summary coverage rate:
  source files: 24
  lines.......: 90.7% (3295 of 3631 lines)
  functions...: no data found
  branches....: no data found
Message summary:
  1 warning message:
    deprecated: 1

Files changed coverage rate:
  	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
                                                                   |Lines       |Functions  |Branches    
  Filename                                                         |Rate     Num|Rate    Num|Rate     Num
  packages/naked_ui/lib/src/naked_disclosure.dart                  |96.8%    190|    -     0|    -      0

@github-actions

Copy link
Copy Markdown
Contributor

LCOV of commit e071ad9 during Flutter CI #305

	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
Reading tracefile /tmp/__zgosalvez_github-actions-report-lcov/lcov.info.
Summary coverage rate:
  source files: 24
  lines.......: 90.7% (3295 of 3631 lines)
  functions...: no data found
  branches....: no data found
Message summary:
  1 warning message:
    deprecated: 1

Files changed coverage rate:
  	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
                                                                   |Lines       |Functions  |Branches    
  Filename                                                         |Rate     Num|Rate    Num|Rate     Num
  packages/naked_ui/lib/src/naked_disclosure.dart                  |96.8%    190|    -     0|    -      0

@leoafarias
leoafarias marked this pull request as ready for review August 21, 2026 18:18
@github-actions

Copy link
Copy Markdown
Contributor

LCOV of commit 3306edb during Flutter CI #306

	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
Reading tracefile /tmp/__zgosalvez_github-actions-report-lcov/lcov.info.
Summary coverage rate:
  source files: 24
  lines.......: 90.8% (3299 of 3635 lines)
  functions...: no data found
  branches....: no data found
Message summary:
  1 warning message:
    deprecated: 1

Files changed coverage rate:
  	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
                                                                   |Lines       |Functions  |Branches    
  Filename                                                         |Rate     Num|Rate    Num|Rate     Num
  packages/naked_ui/lib/src/naked_disclosure.dart                  |96.9%    194|    -     0|    -      0

@leoafarias leoafarias left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Browser validation from Remix found a lifecycle edge case that the widget semantics tests did not catch.\n\nObserved against e071ad9 in a fresh Flutter web session:\n- Initially expanded: aria-controls referenced the current panel DOM semantics node.\n- After collapsing with Enter: aria-controls was removed and the panel semantics node disappeared.\n- After reopening with Space: aria-controls still referenced the old removed DOM node rather than the recreated panel.\n\nThe intermediate 3306edb approach avoided the stale ID but left aria-controls absent after reopening, so it should be treated as superseded rather than an independently valid fix.\n\nThe current 1769db7 approach defers restoring controlsNodes until one frame after the panel remounts. Analyzer and the full naked_ui test suite pass, but final fresh-session browser validation of this head was interrupted and is not complete.\n\nPlease review the timing/lifecycle approach and validate this acceptance condition before merge:\n\n1. Open expanded: aria-controls is non-null and document.getElementById(ariaControls) is the visible panel semantics container.\n2. Collapse with Enter: aria-controls is null and the panel target is absent.\n3. Reopen with Space: aria-controls is non-null and resolves to the newly created panel DOM node.\n4. Repeat the cycle and verify the relationship remains valid.\n\nA web regression test would be ideal if the existing integration-test setup can inspect the generated semantics DOM.

@github-actions

Copy link
Copy Markdown
Contributor

LCOV of commit 1769db7 during Flutter CI #307

	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
Reading tracefile /tmp/__zgosalvez_github-actions-report-lcov/lcov.info.
Summary coverage rate:
  source files: 24
  lines.......: 90.8% (3306 of 3642 lines)
  functions...: no data found
  branches....: no data found
Message summary:
  1 warning message:
    deprecated: 1

Files changed coverage rate:
  	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
                                                                   |Lines       |Functions  |Branches    
  Filename                                                         |Rate     Num|Rate    Num|Rate     Num
  packages/naked_ui/lib/src/naked_disclosure.dart                  |97.0%    201|    -     0|    -      0

@github-actions

Copy link
Copy Markdown
Contributor

LCOV of commit 3d95bfd during Flutter CI #308

	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
Reading tracefile /tmp/__zgosalvez_github-actions-report-lcov/lcov.info.
Summary coverage rate:
  source files: 24
  lines.......: 90.8% (3314 of 3650 lines)
  functions...: no data found
  branches....: no data found
Message summary:
  1 warning message:
    deprecated: 1

Files changed coverage rate:
  	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
                                                                   |Lines       |Functions  |Branches    
  Filename                                                         |Rate     Num|Rate    Num|Rate     Num
  packages/naked_ui/lib/src/naked_disclosure.dart                  |97.1%    209|    -     0|    -      0

@github-actions

Copy link
Copy Markdown
Contributor

LCOV of commit 9df0aea during Flutter CI #309

	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
Reading tracefile /tmp/__zgosalvez_github-actions-report-lcov/lcov.info.
Summary coverage rate:
  source files: 24
  lines.......: 90.5% (3304 of 3651 lines)
  functions...: no data found
  branches....: no data found
Message summary:
  1 warning message:
    deprecated: 1

Files changed coverage rate:
  	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
                                                                   |Lines       |Functions  |Branches    
  Filename                                                         |Rate     Num|Rate    Num|Rate     Num
  packages/naked_ui/lib/src/naked_disclosure.dart                  |91.9%    210|    -     0|    -      0

@leoafarias leoafarias left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

​

@leoafarias
leoafarias merged commit a5bc598 into main Aug 21, 2026
7 checks passed
@leoafarias
leoafarias deleted the fix/disclosure-semantics-relationship branch August 21, 2026 19:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant