Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text field with empty value omits html props #2009

Open
ahiyalala opened this issue Jan 17, 2025 · 1 comment
Open

Text field with empty value omits html props #2009

ahiyalala opened this issue Jan 17, 2025 · 1 comment
Labels
backlog Issue/PR/discussion is reviewed and added to backlog for the further work 🐞 bug

Comments

@ahiyalala
Copy link

Describe the Bug

When a <Text /> field has an empty value, the styling that was intended for this element was omitted because the htmlProps were not applied to the DefaultEmptyFieldEditingComponentText whose rendering was only return <span>[No text in field]</span>

To Reproduce

Create a styling for the text element, for example:

.bg-red {
 background-color: red;
}

Apply CSS class in the <Text /> component:

<Text tag="p" className="bg-red" field={props.field.TextField} />

Where props.field.TextField is a Field<string> and is empty.

Here's a real life example, where the field Secondary Topic is empty in one, and populated on another
Image

Expected Behavior

Styling should still appear even if the text field has an empty value.

Possible Fix

Ensure DefaultEmptyFieldEditingComponentText component would still apply the htmlProps

Provide environment information

  • Sitecore Version: XM Cloud
  • JSS Version: 22.1.4
  • Browser Name and version: Edge/Chromium
  • Operating System and version (desktop or mobile): Windows 11
  • Link to your project (if available): N/A
@art-alexeyenko art-alexeyenko added the backlog Issue/PR/discussion is reviewed and added to backlog for the further work label Jan 28, 2025
@art-alexeyenko
Copy link
Contributor

Thanks @ahiyalala for a clear scenario. I've added this to our team's backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Issue/PR/discussion is reviewed and added to backlog for the further work 🐞 bug
Projects
None yet
Development

No branches or pull requests

2 participants