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

Add help and aria described by to list input component #1587

Merged
merged 1 commit into from May 20, 2019

Conversation

jcaianirh
Copy link
Member

@jcaianirh jcaianirh commented May 18, 2019

And add help text and aria-describedby for all idp pages using the list input component.

Screen Shot 2019-05-18 at 3 03 09 PM

after margin change:

Screen Shot 2019-05-20 at 11 54 38 AM

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 18, 2019
@@ -81,5 +85,7 @@ type ListInputProps = {
label: string;
initialValues?: string[];
onChange: ChangeCallback;
describedBy: string;
Copy link
Member

@spadgett spadgett May 19, 2019

Choose a reason for hiding this comment

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

You shouldn't need to pass this in. I'd just generated a unique value for the ID. You could use _.uniqueId to generate one in the constructor:

  this.helpID = _.uniqueId('list-view-help-');

then

aria-describedby={helpText ? this.helpID : undefined}

@@ -63,6 +64,9 @@ export class ListInput extends React.Component<ListInputProps, ListInputState> {
</div>
</div>
))}
<div className="help-block" id={describedBy}>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<div className="help-block" id={describedBy}>
{helpText && <div className="help-block" id={describedBy}>{helpText}</div>}

Copy link
Member Author

Choose a reason for hiding this comment

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

@spadgett i had this before, and thought you'd just say make help text required and we won't need this logic. And i also thought, if helptext is optional now the aria-describedBy will be provided but null.

Copy link
Member

Choose a reason for hiding this comment

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

If you provide undefined for aria-describedby when there's no help text, the attr should be left out. It should be straightforward to handle.

Copy link
Member Author

Choose a reason for hiding this comment

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

@spadgett oh perfect, yeah its not a problem i was just trying to anticipate your feedback :)

@spadgett
Copy link
Member

It looks like the help text is closer to "add more" than the input. I think we want a little extra margin above "add more."

@jcaianirh
Copy link
Member Author

@spadgett updated based on feedback

@jcaianirh
Copy link
Member Author

@spadgett good point, this should improve on the last change.

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

lgtm, please squash. thanks!

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 20, 2019
Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 20, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dtaylor113, jcaianirh, spadgett

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit b691ec6 into openshift:master May 20, 2019
@spadgett spadgett added this to the v4.2 milestone May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants