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

fix(textarea, textbox): ensure inputHint and labelHelp props do not render two seperate DOM elements #6363

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

tomdavies73
Copy link
Contributor

@tomdavies73 tomdavies73 commented Oct 11, 2023

Proposed behaviour

Screenshot 2023-10-11 at 13 28 40

Currently, when consumers are opted into the new validation designs two separate DOM elements are rendered which both act as hints for the input. This has been addressed by only rendering either the inputHint or labelHelp props in the same element, with inputHint taking priority.

Current behaviour

Screenshot 2023-10-11 at 13 33 04

Currently, when consumers are opted into the new validation designs two separate DOM elements are rendered which both act as hints for the input.

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Cypress automation tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in CodeSandbox/storybook
  • Add new Cypress test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

The following CodeSandbox is an example of the broken behaviour.
You can see the new behaviour by looking at the version in the comment by codesandbox[bot].

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 11, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0df5be9:

Sandbox Source
carbon-quickstart Configuration
carbon-quickstart-typescript Configuration
carbon-quickstart PR

@@ -84,7 +80,7 @@ export interface TextareaProps
label?: string;
/** Inline label alignment */
labelAlign?: "left" | "right";
/** Text applied to label help tooltip */
/** [Legacy] Text applied to label help tooltip */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: might be worth adding that if you have the redesign flag set and no inputHint prop this will be used etc

{...{ [validationType]: "Message" }}
m={4}
/>
<Textarea
label={`readOnly - ${validationType}`}
inputHint="Hint text (optional)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inputHint="Hint text (optional)"
inputHint="Hint text (optional)."

😆

Copy link
Contributor

@edleeks87 edleeks87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff @tomdavies73, I think it would also be worth adding some tests that confirm the behaviour we're wanting when both props are set

@Parsium Parsium self-requested a review October 12, 2023 13:19
Copy link
Contributor

@Parsium Parsium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing major to add to @edleeks87's comments 👍🏼

src/components/decimal/decimal.stories.mdx Outdated Show resolved Hide resolved
Parsium
Parsium previously approved these changes Oct 16, 2023
edleeks87
edleeks87 previously approved these changes Oct 16, 2023
…ender two seperate DOM elements

currently when consumers are opted into the new validation designs two seperate DOM elements are
rendered which both act as hints for the input. This has been addressed by only rendering either the
`inputHint` or `labelHelp` props in the same element, with `inputHint` taking priority
@tomdavies73 tomdavies73 merged commit 909d7d1 into master Oct 27, 2023
@tomdavies73 tomdavies73 deleted the FE-6241 branch October 27, 2023 10:59
@carbonci
Copy link
Collaborator

🎉 This PR is included in version 123.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

6 participants