ic-ui-kit icon indicating copy to clipboard operation
ic-ui-kit copied to clipboard

Text alignment issues on components with labels, helpertext or validation

Open ad9242 opened this issue 1 year ago • 3 comments

Summary of the bug

Text does not appear left aligned when a component is placed inside a container with textAlign: center

🪜 How to reproduce

With the following code in the React storybook:

<div style={{textAlign:"center"}}>
      <IcTextField
        label="What is your favourite coffee?"
        required
        placeholder="Placeholder"
        helperText="Such as Arabica, Robusta or Liberica"
        validationStatus="error"
        validationText="Now it has really gone to (coffee) pot"
      />
      <IcTextField
        rows="6"
        label="What is your favourite coffee?"
        required
        placeholder="Placeholder"
        helperText="Such as Arabica, Robusta or Liberica"
      />
    </div>

📸 Screenshots or code

image

🧐 Expected behaviour

To be confirmed with design, but expectation is all text should align with the left edge of the input

📝 Acceptance Criteria

Given a component had a label, helper text or validation message When it is placed in a container with textAlign: center Then the text should remain aligned to the left hand side of the input element

Additional info

Affects at least textfield, select, date input, checkbox, radio

ad9242 avatar Apr 16 '24 09:04 ad9242

Agreed to left align. Shouldn't the Shadow DOM stop this, or are they not shadow components?

MI6-255 avatar Apr 18 '24 08:04 MI6-255

Add a test

MI6-255 avatar Apr 18 '24 08:04 MI6-255

This occurs on footer as well

Image

GCHQ-Developer-530 avatar Apr 23 '24 13:04 GCHQ-Developer-530