Skip to content

Fix text spacing visual helper not applying to input/button elements#7704

Open
v-sohmondal wants to merge 3 commits intomainfrom
users/v-sohmondal/fix-text-spacing-visual-helper-issue-4800
Open

Fix text spacing visual helper not applying to input/button elements#7704
v-sohmondal wants to merge 3 commits intomainfrom
users/v-sohmondal/fix-text-spacing-visual-helper-issue-4800

Conversation

@v-sohmondal
Copy link
Copy Markdown
Contributor

@v-sohmondal v-sohmondal commented Nov 28, 2025

Summary

Fixes #4800

Added explicit CSS selectors for form elements (input, button, select, textarea) within .insights-formatted-text-spacing-container to directly apply text spacing styles. Browser user-agent stylesheets define default styles for these elements that override inherited values, so they require direct targeting.

This approach uses specific element selectors rather than a wildcard (*) for better performance and controlled targeting.

Testing

Reproduced the bug on main branch
Screenshot 2025-11-28 112505

Fix Branch (After Fix)

  • Input fields now properly get text spacing
  • Buttons now properly get text spacing
Screenshot 2025-11-28 113515

Details

Added nested selectors for form elements in injected.scss. The container still uses inheritance for most elements, but form elements are explicitly targeted to override browser defaults.

Motivation

Addresses issue #4800 - users reported that the text spacing visual helper (used in WCAG 2.1 SC 1.4.12 assessments) was not working on input fields, buttons, and elements with CSS-in-JS styling.

Context

Form elements (input, button, select, textarea) have browser-defined default styles that override CSS inheritance

Pull request checklist

  • Addresses an existing issue: Visual helper for text spacing fails to change the spacing for text in input fields and buttons #4800
  • Ran yarn fastpass
  • Added/updated relevant unit test(s) (and ran yarn test)
  • Verified code coverage for the changes made. Check coverage report at: <rootDir>/test-results/unit/coverage
  • PR title AND final merge commit title both start with a semantic tag (fix:, chore:, feat(feature-name):, refactor:). See CONTRIBUTING.md.
  • (UI changes only) Added screenshots/GIFs to description above
  • (UI changes only) Verified usability with NVDA/JAWS

Fixes #4800

Changed CSS selector from .insights-formatted-text-spacing-container to
.insights-formatted-text-spacing-container * to directly target all descendant
elements instead of relying on inheritance. This ensures WCAG text spacing
requirements are properly applied to input fields, buttons, and elements with
CSS-in-JS styling that were previously overriding the inherited values.

The universal descendant selector with !important successfully overrides:
- Browser user-agent styles
- Class selectors
- Inline styles from CSS-in-JS
- Other specificity conflicts

This follows the same pattern already proven successful in
.insights-pseudo-selector-style-container.
@v-sohmondal v-sohmondal marked this pull request as ready for review March 9, 2026 07:00
@v-sohmondal v-sohmondal requested a review from a team as a code owner March 9, 2026 07:00
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.

Visual helper for text spacing fails to change the spacing for text in input fields and buttons

1 participant