Skip to content

Add Field Level Help and Inline Help variants to Input #1491

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

Merged
merged 2 commits into from
Aug 20, 2018

Conversation

garygong
Copy link
Contributor

@garygong garygong commented Aug 8, 2018

This implements the "Field level help" and "Inline help" variants for Input.

screen shot 2018-08-07 at 9 56 38 pm

screen shot 2018-08-07 at 9 56 44 pm

@interactivellama can you take a look? Thanks!

Fixes #1474

Additional description


CONTRIBUTOR checklist (do not remove)

Please complete for every pull request

  • First-time contributors should sign the Contributor License Agreement. It's a fancy way of saying that you are giving away your contribution to this project. If you haven't before, wait a few minutes and a bot will comment on this pull request with instructions.
  • npm run lint:fix has been run and linting passes.
  • Mocha, Jest (Storyshots), and components/component-docs.json CI tests pass (npm test).
  • Tests have been added for new props to prevent regressions in the future. See readme.
  • Review the appropriate Storybook stories. Open http://localhost:9001/.
  • The Accessibility panel of each Storybook story has 0 violations (aXe). Open http://localhost:9001/.
  • Review tests are passing in the browser. Open http://localhost:8001/.
  • Review markup conforms to SLDS by looking at DOM snapshot strings.

REVIEWER checklist (do not remove)

  • TravisCI tests pass. This includes linting, Mocha, Jest, Storyshots, and components/component-docs.json tests.
  • Tests have been added for new props to prevent regressions in the future. See readme.
  • Review the appropriate Storybook stories. Open http://localhost:9001/.
  • The Accessibility panel of each Storybook story has 0 violations (aXe). Open http://localhost:9001/.
  • Review tests are passing in the browser. Open http://localhost:8001/.
  • Review markup conforms to SLDS by looking at DOM snapshot strings.
  • Add year-first date and commit SHA to last-slds-markup-review in package.json and push.
  • Request a review of the deployed Heroku app by the Salesforce UX Accessibility Team.
  • Add year-first review date, and commit SHA, last-accessibility-review, to package.json and push.
  • While the contributor's branch is checked out, run npm run local-update within locally cloned site repo to confirm the site will function correctly at the next release.

@garygong garygong self-assigned this Aug 8, 2018
<Tooltip
align="top left"
content="Some helpful information"
position="overflowBoundaryElement"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have it so that a default trigger is used if none is specified here because it's usually going to be the "i" info icon. What do you think?

Also, I saw that slds-form-element__icon adds position: relative to the trigger, which made the popover width much smaller. Using overflowBoundaryElement sizes the width to the tooltip contents.

Copy link
Contributor

@interactivellama interactivellama Aug 15, 2018

Choose a reason for hiding this comment

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

I've responded to this inline below. I'd like to use inline styles and use the default non-portal positioning.

@garygong garygong changed the title Add Field Level Help and Inline Help to Input Add Field Level Help and Inline Help variants to Input Aug 8, 2018
this.props.fieldLevelHelpTooltip
) {
const defaultProps = {
triggerClassName: 'slds-form-element__icon',
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's do triggerStyle: { position: 'static' } instead of position="overflowBoundaryElement" in the examples in order to reset the CSS and folks can override in the tooltip.

This is most likely a side effect however Platform implements tooltips, it isn't inline, so it doesn't show up on the SLDS radar.

<Tooltip
align="top left"
content="Some helpful information"
position="overflowBoundaryElement"
Copy link
Contributor

@interactivellama interactivellama Aug 15, 2018

Choose a reason for hiding this comment

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

I've responded to this inline below. I'd like to use inline styles and use the default non-portal positioning.

@@ -231,4 +232,29 @@ storiesOf(FORMS_INPUT, module)
placeholder="My placeholder"
/>
</section>
))
.add('Inline Help', () => (
<section>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move the two new examples to external files and add them to components/site-stories.js

@@ -501,4 +503,62 @@ describe('SLDSInput', () => {
expect(fixedTextLeft.textContent).to.equal('$');
});
});

describe('Inline Help', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could move these markup tests to jest/storybook examples?

I will try to get the comment header on Mocha test files added in the next week, so it's more obvious for everyone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call!

/**
* Displays help text under the input.
*/
inlineHelpText: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should string or node, so you can do span, etc.

triggerClassName: 'slds-form-element__icon',
children: (
<Button
assistiveText={{ label: 'Help' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be able to be internationalized and added to assistiveText object. fieldLevelHelpButton, maybe?

Copy link
Contributor

@interactivellama interactivellama left a comment

Choose a reason for hiding this comment

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

Feedback. Apologies for it taking 8 days.

@garygong
Copy link
Contributor Author

garygong commented Aug 18, 2018

@interactivellama check out the changes based on your comments here: 18df0be thanks!

@interactivellama
Copy link
Contributor

Looks good! Thanks @garygong

screen shot 2018-08-20 at 5 45 57 pm

@interactivellama interactivellama merged commit df90f0f into salesforce:master Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Field Level Help and Inline Help for Input
2 participants