Skip to content

Conversation

@cdransf
Copy link
Member

@cdransf cdransf commented Oct 22, 2025

Description

Fixed Safari-specific rendering issue where the required asterisk in sp-field-label would intermittently wrap to a new line. The solution uses CSS-only changes to ensure the asterisk always stays inline with the label text.

Changes:

  • Updated label element to use display: inline-flex with white-space: nowrap
  • Added flex-shrink: 0 to .required-icon to prevent asterisk from shrinking

Motivation and context

Safari (desktop and iPad) had an intermittent rendering bug where the required field asterisk would wrap to the next line, especially within flex containers. This was unpredictable and occurred on page refresh. The issue impacted form usability and visual consistency across browsers.

Related issue(s)

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Required asterisk stays inline in Safari

    1. Open Storybook in Safari: Field Label → Required In Flex Container
    2. Refresh the page multiple times (Cmd+R)
    3. Verify asterisk never wraps to a new line in any test case
  • Required asterisk displays correctly across all size variants

    1. Navigate to Field Label → Required story
    2. Check small, medium, large, and xl sizes
    3. Confirm asterisk is visible and inline for all sizes
  • Side-aligned labels maintain correct alignment

    1. Check Field Label → Side Align Start and Side Align End stories
    2. Add required attribute to examples
    3. Verify asterisk positioning is correct
  • Existing field label behavior is unchanged

    1. Test in forms with field-label (e.g., Textfield, Picker stories)
    2. Verify no layout regressions
    3. Check disabled state rendering

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

@changeset-bot
Copy link

changeset-bot bot commented Oct 22, 2025

⚠️ No Changeset found

Latest commit: 6075d1f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cdransf cdransf self-assigned this Oct 22, 2025
@cdransf cdransf added the Status: WIP PR is a work in progress or draft label Oct 22, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

📚 Branch Preview

🔍 Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-5822

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@github-actions
Copy link
Contributor

Tachometer results

Currently, no packages are changed by this PR...

@coveralls
Copy link
Collaborator

coveralls commented Oct 22, 2025

Pull Request Test Coverage Report for Build 18920057634

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 97.966%

Totals Coverage Status
Change from base Build 18885025935: 0.002%
Covered Lines: 34259
Relevant Lines: 34788

💛 - Coveralls

@cdransf cdransf force-pushed the cdransf/safari-required-wrapping branch 4 times, most recently from 6deb824 to acdec8d Compare October 22, 2025 22:45
@cdransf cdransf marked this pull request as ready for review October 22, 2025 23:05
@cdransf cdransf requested a review from a team as a code owner October 22, 2025 23:05
@cdransf cdransf added the Status: Ready for review PR ready for review or re-review. label Oct 22, 2025
@cdransf cdransf force-pushed the cdransf/safari-required-wrapping branch from 4d9aea8 to 03260a4 Compare October 24, 2025 22:12
@cdransf cdransf removed the Status: WIP PR is a work in progress or draft label Oct 27, 2025
@cdransf cdransf force-pushed the cdransf/safari-required-wrapping branch from c601464 to 296df61 Compare October 27, 2025 17:10
@cdransf cdransf force-pushed the cdransf/safari-required-wrapping branch 2 times, most recently from 2fbab5b to c85d47e Compare October 29, 2025 17:52
@cdransf cdransf force-pushed the cdransf/safari-required-wrapping branch from 5d7d7e5 to 6075d1f Compare October 29, 2025 19:39
@Rajdeepc
Copy link
Contributor

Hi @cdransf, as part of the review process, could you please revert the golden hash so I can update the visuals that the VRT is flagging? Once your changes are approved, you can reapply the golden hash to accept the updated baseline.

@Rajdeepc Rajdeepc changed the title fix(field-label): address edge case where required icon would not render on the same line fix(field-label): address edge case where required icon would not render on the same line(Safari only) Oct 30, 2025
@cdransf cdransf added blocked Ticket or PR is blocked for some reason, eg another PR needs to go in first and removed Status: Ready for review PR ready for review or re-review. labels Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Ticket or PR is blocked for some reason, eg another PR needs to go in first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Required field label sometimes renders asterisk on next line

4 participants