Fix text spacing visual helper not applying to input/button elements#7704
Open
v-sohmondal wants to merge 3 commits intomainfrom
Open
Fix text spacing visual helper not applying to input/button elements#7704v-sohmondal wants to merge 3 commits intomainfrom
v-sohmondal wants to merge 3 commits intomainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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

Fix Branch (After Fix)
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
yarn fastpassyarn test)<rootDir>/test-results/unit/coveragefix:,chore:,feat(feature-name):,refactor:). SeeCONTRIBUTING.md.