Skip to content

Conversation

@redallen
Copy link
Contributor

@redallen redallen commented Apr 9, 2019

What: Resolves #1529. Resolves jest console errors related to aria props.

Additional issues: Check snapshots to make sure non-custom elements are not changed.

@redallen redallen self-assigned this Apr 9, 2019
@redallen redallen added Breaking change 💥 this change requires a major release and has API changes. PF4 labels Apr 9, 2019
@tlabaj tlabaj added the A11y label Apr 9, 2019
@tlabaj tlabaj requested a review from jgiardino April 9, 2019 17:02
@codecov-io
Copy link

codecov-io commented Apr 9, 2019

Codecov Report

Merging #1731 into master will increase coverage by 0.01%.
The diff coverage is 95.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1731      +/-   ##
==========================================
+ Coverage   82.67%   82.69%   +0.01%     
==========================================
  Files         598      598              
  Lines        6626     6639      +13     
  Branches       75       75              
==========================================
+ Hits         5478     5490      +12     
- Misses       1118     1119       +1     
  Partials       30       30
Flag Coverage Δ
#patternfly3 84.87% <ø> (ø) ⬆️
#patternfly4 79.27% <95.91%> (+0.06%) ⬆️
#patternflymisc 95.68% <ø> (ø) ⬆️
Impacted Files Coverage Δ
...y-4/react-core/src/components/Dropdown/Dropdown.js 95.65% <ø> (ø) ⬆️
...react-core/src/components/Select/CheckboxSelect.js 94.44% <ø> (ø) ⬆️
...fly-4/react-core/src/components/Dropdown/Toggle.js 58.62% <ø> (ø) ⬆️
...e/src/components/AboutModal/AboutModalContainer.js 88.88% <ø> (ø) ⬆️
...eact-core/src/components/Pagination/OptionsMenu.js 92.3% <ø> (ø) ⬆️
...-4/react-core/src/components/Modal/ModalContent.js 81.81% <ø> (ø) ⬆️
.../src/components/ContextSelector/ContextSelector.js 84.61% <ø> (ø) ⬆️
...ponents/ApplicationLauncher/ApplicationLauncher.js 50% <ø> (ø) ⬆️
...rnfly-4/react-core/src/components/Select/Select.js 93.33% <ø> (ø) ⬆️
...ternfly-4/react-core/src/components/Alert/Alert.js 100% <ø> (ø) ⬆️
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67190ab...c2ea61a. Read the comment docs.

@redallen redallen changed the title fix(aria): make aria-* props consistent fix(aria): make aria-* component props consistent Apr 9, 2019
@patternfly-build
Copy link
Collaborator

PatternFly-React preview: https://1731-pr-patternfly-react-patternfly.surge.sh

@jgiardino
Copy link
Contributor

jgiardino commented Apr 9, 2019

I'm seeing a difference in font size for the Alert description:
image

I only see this issue in Chrome, and it looks like Chrome is pulling the styles in twice.

cc'ing @mcoker on this one

UPDATE - I added this to #1724

@redallen
Copy link
Contributor Author

redallen commented Apr 9, 2019

Yeah, the styles are generally wrong on the new doc site. Please add that issue (and any others you find) to #1724 !

id={id}
className={css(styles.dataListExpandableContent, className)}
hidden={isHidden}
aria-label={ariaLabel}
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be out of scope for this PR and belong in a separate issue...

The props documentation states:

Name Type Required Default Description
aria-label string     Adds accessible text to the DataList toggle

But the description seems to describe the DataListToggle component. In this context, it's providing an accessible label for the expandable content section.

And when looking at the DataListToggle component the following are documented:

Name Type Required Default Description
aria-labelledby string   '' Adds accessible text to the DataList toggle
aria-label string   'Details' Adds accessible text to the DataList toggle

But only aria-label is accepted as a prop. If I provide a value for aria-labelledby on the component, that value doesn't display in the html.

Currently, aria-labelledby is defined on the html element only if the consumer doesn't define aria-label. If aria-label is defined, then the aria-labelledby attribute is removed from the html. This is as designed (e.g. either the consumer uses our default label, which we generate using aria-labelledby, or they explicitly define the full text string using aria-label).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct, it's ignored. The old logic is:

aria-labelledby={ariaLabel !== "Details" ? null : ${rowid} ${id}}

I'm changing it to

if (ariaLabel === "Details") {
    ariaLabelledBy = `${rowid} ${id}`;
}

since it probably wasn't intended for the property to do nothing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! These updates work as expected except for the following...

When I define aria-label on the DataListToggle, in the PR preview I will see aria-labelledby included without a value.

In the current implementation, aria-labelledby is not included on the element at all. This is the expected behavior.

As for removing aria-labelledby from the documentation for DataListToggle, should I create a separate issue for that?

rememberMeAriaLabel: props => {
if (props.rememberMeLabel && !props.rememberMeAriaLabel) {
return new Error('rememberMeAriaLabel is required with the Remember me checkbox');
'aria-label': props => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This one might also be a separate issue, but this attribute should be removed from this checkbox. In this case, the aria-label is overwriting the text defined in the <label>.

Let me know if an issue is needed for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, there's an issue in the preview. This error is displaying:

SyntaxError: Invalid or unexpected token

I'm not sure if this is what's causing the issue, but I see that this prop is still being defined on LoginForm even though you changed it to aria-label:
rememberMeAriaLabel="Remember me Checkbox"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why should the attribute be removed? This is starting to get outside the scope of this PR, so a separate issue would be nice.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 I created #1737 for my first comment.

But the second comment might still be relevant to this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The login page has been broken since #1656 (see preview). Fixing it is a part of #1724 which is next on my list.

@redallen
Copy link
Contributor Author

redallen commented Apr 9, 2019

Let me know if there are still any problem with the Modal or Select, but I think updating them in the docs fixed them! The preview just now redeployed with the changes.

rightScrollAriaLabel: 'Scroll Right',
'aria-label': null,
'aria-label-left-scroll': 'Scroll left',
'aria-label-right-scroll': 'Scroll Right',
Copy link
Contributor

Choose a reason for hiding this comment

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

When I define aria-label-left-scroll as a prop on the Tabs component, I'm not seeing that string included on the button.

const unique_id = id ? id : getUniqueId();
return variant === TabsVariant.nav
? <TabsWithNav ariaLabel={ariaLabel} id={unique_id} {...props} />
? <TabsWithNav id={unique_id} {...props} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently there's an example labeled Accessible primary tabs with aria-label that shows the <nav> variant with aria-label. I'm not seeing this example in the preview.

@jgiardino
Copy link
Contributor

The issues with Modal and Tabs are resolved now! 🎉

className: PropTypes.string,
onClose: PropTypes.func,
'aria-label': PropTypes.string
'aria-label-button': 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.

Related to discussion in slack, let's use ariaLabelClose instead.

position: PropTypes.oneOf(Object.values(ApplicationLauncherPosition)),
/** Adds accessible text to the button. Required for plain buttons */
'aria-label': PropTypes.string
'aria-label-button': 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.

Let's use ariaLabelToggle instead.

children: PropTypes.node,
/** Aria Label for close button */
'aria-label': PropTypes.string,
'aria-label-button': 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.

Let's use ariaLabelClose instead.

toggleText: PropTypes.string,
/** aria-label for the Context Selector Search Button */
'aria-label': PropTypes.string,
'aria-label-search': 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.

Let's use ariaLabelSearch instead.

/** Callback function to handle the side nav toggle button */
'aria-label': PropTypes.string,
/** aria-label for the button */
'aria-label-button': 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.

Let's use ariaLabelNavToggle instead.

@jgiardino
Copy link
Contributor

Rather than try to find these inline and be wrong, here are a few more prop names to change based on the slack discussion.

  • Select Properties:
    • aria-label > ariaLabelPanel
    • aria-labelledby > ariaLabelledbyToggle
  • CheckboxSelect Properties:
    • aria-label > ariaLabelPanel
      • I wasn't sure if this should be ariaLabelFieldset instead, but since it's nearly identical in behavior with the first bullet, I'm thinking we can just be consistent with that.

@redallen
Copy link
Contributor Author

With the Typescript conversion, this PR is in a terrible state. The issue still exists and can be resolved in a breaking change release later.

@redallen redallen closed this May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A11y Breaking change 💥 this change requires a major release and has API changes. Do Not Merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix accessibility prop name inconsistencies

5 participants