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(number-input): remove default value for label #5347

Merged
merged 3 commits into from
Feb 17, 2020
Merged

fix(number-input): remove default value for label #5347

merged 3 commits into from
Feb 17, 2020

Conversation

abbeyhrt
Copy link
Contributor

Closes #5341

This removes the default prop for label so the label element isn't always rendered, for example if a user wants to label the Number Input with ariaLabel instead.

Changelog

Removed

  • label default prop

Testing / Reviewing

Check that if label is empty, no label element is rendered

@abbeyhrt abbeyhrt requested a review from a team as a code owner February 13, 2020 19:15
@ghost ghost requested review from joshblack and tw15egan February 13, 2020 19:15
@netlify
Copy link

netlify bot commented Feb 13, 2020

Deploy preview for carbon-elements ready!

Built with commit 5047ceb

https://deploy-preview-5347--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Feb 13, 2020

Deploy preview for carbon-components-react ready!

Built with commit 5047ceb

https://deploy-preview-5347--carbon-components-react.netlify.com

Copy link
Contributor

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

Looks fine from the diff, what are the implications for removing it? Does any part of the rendered UI change for folks who might be using the default prop?

@asudoh asudoh requested review from a team and designertyler and removed request for a team February 13, 2020 23:45
@asudoh
Copy link
Contributor

asudoh commented Feb 13, 2020

@abbeyhrt Would you be able to do some quick testing if setting empty label has the same visual effect as hideLabel? Thanks!

@abbeyhrt
Copy link
Contributor Author

abbeyhrt commented Feb 14, 2020

@joshblack @asudoh in the storybook, it seems to move a 7 pixels down if there is no label present vs hideLabel (this is true before this PR though). There's code that seems to want the label element to not be rendered if there is no label defined but the default prop makes that never happen unless someone deliberately sets label to null. We maybe always wanted this to happen but it's been broken?

    const labelText = label ? (
      <label htmlFor={id} className={labelClasses}>
        {label}
      </label>
    ) : null;
     'aria-label': label ? null : ariaLabel,

@asudoh
Copy link
Contributor

asudoh commented Feb 15, 2020

@abbeyhrt To do that, I think we need to ensure the styling of hideLabel is applied to <NumberInput> with empty value. Signing off given @designertyler created an issue to track that.

Copy link
Member

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

LGTM 👍 ✅

@abbeyhrt abbeyhrt merged commit acb9458 into carbon-design-system:master Feb 17, 2020
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.

[Number Input]: label default prop causes label to always render then ariaLabel isn't applied
5 participants