Skip to content

fix: emit skipped component attrs with static and embedded values#173

Merged
mohamedmansour merged 2 commits intomainfrom
akroshg/fix-skip-attr-static-embedded
Apr 6, 2026
Merged

fix: emit skipped component attrs with static and embedded values#173
mohamedmansour merged 2 commits intomainfrom
akroshg/fix-skip-attr-static-embedded

Conversation

@akroshg
Copy link
Copy Markdown
Contributor

@akroshg akroshg commented Apr 6, 2026

Summary

Fix skipped component attributes (class, style, role, data-, aria-) to emit fragments for all value types, not just pure handlebars bindings.

Problem

When a component element has skipped attributes with static or mixed values, the parser silently dropped them:

  • role="list" dropped (static value)
  • aria-labelledby="prefix-{{id}}" dropped (embedded binding)
  • role="{{dynamicRole}}" emitted (pure binding, already worked)

This meant the handler never saw these attributes, so they couldn't be rendered in the SSR output.

Fix

All three forms now emit attribute fragments with attr_skip: true:

Form Fragment fields
Pure binding: role="{{x}}" value: "x" (unchanged)
Embedded binding: aria-label="pre-{{id}}" template: "attr-N" (sub-stream with static + signal parts)
Static value: role="list" value: "list", raw_value: true

Changes

  • webui-parser: Handle static and embedded-binding cases in the skip-attribute branch
  • webui-test-utils: Add attr_skip_raw and attr_skip_template test matchers
  • Tests: New test_component_attr_skip_static_and_embedded covering all three forms with template sub-stream verification

Previously, skipped component attributes (class, style, role, data-*,
aria-*) were only emitted when they contained a pure handlebars binding
like role="{{dynamicRole}}". Static values (role="list") and embedded
bindings (aria-labelledby="prefix-{{id}}") were silently dropped.

Now all three forms are emitted as attribute fragments:
- Pure binding: attr_skip with value (existing behavior)
- Embedded binding: attr_skip with template sub-stream
- Static value: attr_skip with raw_value flag

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mohamedmansour
mohamedmansour previously approved these changes Apr 6, 2026
@mohamedmansour mohamedmansour merged commit 84016d2 into main Apr 6, 2026
21 checks passed
@mohamedmansour mohamedmansour deleted the akroshg/fix-skip-attr-static-embedded branch April 6, 2026 23:26
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.

2 participants