Skip to content

Conversation

@robearlam
Copy link
Member

This fixes the bug where Text based TagHelpers can't render inside of a p tag, causing all of MetaData editing to break.

This aligns with the JSS approach of using a span tag instead.

I also introduced a new Assert to the appropriate UnitTests as that tag insertion wasn't being tested currently.

Testing

  • The Unit & Intergration tests are passing.
  • I have added the necessary tests to cover my changes.

Terms

Closes #39

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug where text-based TagHelpers incorrectly rendered chrome wrappers using div tags instead of span tags, which caused rendering issues when placed inside a p tag. Key changes include:

  • Replacing
    with for opening and closing chrome wrappers in both TextFieldTagHelper and RichTextTagHelper.
  • Updating corresponding unit tests to expect tags.
  • Reordering using directives in RichTextTagHelperFixture for consistency.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/Sitecore.AspNetCore.SDK.RenderingEngine.Tests/TagHelpers/Fields/TextFieldTagHelperFixture.cs Updated assertion to expect wrappers in rendered output
tests/Sitecore.AspNetCore.SDK.RenderingEngine.Tests/TagHelpers/Fields/RichTextTagHelperFixture.cs Updated assertion to expect wrappers and reordered using directives
src/Sitecore.AspNetCore.SDK.RenderingEngine/TagHelpers/Fields/TextFieldTagHelper.cs Changed chrome wrapper tag from div to span
src/Sitecore.AspNetCore.SDK.RenderingEngine/TagHelpers/Fields/RichTextTagHelper.cs Changed chrome wrapper tag from div to span
Comments suppressed due to low confidence (1)

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Tests/TagHelpers/Fields/RichTextTagHelperFixture.cs:1

  • [nitpick] The reordering of using directives in this test file differs from other files; please confirm that this rearrangement aligns with the project's coding style guidelines.
using AutoFixture;

Copy link
Member

@sc-ivanlieckens sc-ivanlieckens left a comment

Choose a reason for hiding this comment

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

So we're using a text level semantic element to group content? A rich text element can contain a lot of various elements, lots of them being invalid inside of a span afaik? It also changes the default style from block to inline... This feels wrong?

Copy link
Member

@sc-ivanlieckens sc-ivanlieckens left a comment

Choose a reason for hiding this comment

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

Approving as temp solution to unblock. JSS and Pages Team contacted for proper resolution.

@robearlam robearlam merged commit acaaf29 into main Jun 23, 2025
4 checks passed
@robearlam robearlam deleted the bug/39-metadata-text-taghelpers branch June 23, 2025 00:40
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.

Issue with MetaData editing using inline code tag injection for a P tag

3 participants