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

feat(Dropdown): Allow for tooltips on aria-disabled items #6038

Merged
merged 6 commits into from
Aug 2, 2021

Conversation

nicolethoen
Copy link
Contributor

What: Closes #5826

You can see it working in the very first example - one of the disabled items is now using aria-disabled with a simple tooltip.

@patternfly-build
Copy link
Contributor

patternfly-build commented Jul 15, 2021

mcarrano
mcarrano previously approved these changes Jul 15, 2021
Copy link
Member

@mcarrano mcarrano left a comment

Choose a reason for hiding this comment

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

Looks great @nicolethoen !

mcoker
mcoker previously approved these changes Jul 16, 2021
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

LGTM!

dlabrecq
dlabrecq previously approved these changes Jul 19, 2021
@@ -264,7 +267,7 @@ export class InternalDropdownItem extends React.Component<InternalDropdownItemPr
role={role}
onKeyDown={this.onKeyDown}
onClick={(event: any) => {
if (!isDisabled) {
if (!isDisabled && !isAriaDisabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be an || instead? Or does isDisabled also set isAriaDisabled if isAriaDisabled isn't passed in.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good question. Maybe add a test for this scenario.

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 may be going cross eyed - but i think it's true that if the dropdown item is disabled OR ariaDisabled, then we don't want to fire the passed in onClick or onSelect handlers. So this logic, with the && is right.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh you're right, the double negative with the && got me

Copy link
Contributor

Choose a reason for hiding this comment

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

Can rewrite as isDisabled || isAriaDisabled to be more clear. de Morgan's theorem states !A && !B = A || B.

Copy link
Contributor

@jessiehuff jessiehuff left a comment

Choose a reason for hiding this comment

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

Hmm what's odd is that this seems to work in JAWS, but not in VO and NVDA. I'm not quite sure why yet.

@tlabaj tlabaj added the A11y label Jul 23, 2021
@nicolethoen
Copy link
Contributor Author

@jessiehuff did you do any more investigation into this? I can try playing with it in VO this afternoon.

@jessiehuff
Copy link
Contributor

I'm wondering if what Katie pointed out above is affecting the screen reader experience. It seems like if it's just isAriaDisabled this might not work on click which the screen reader may rely on? It's also probably worth noting what we did in button to prevent events. Maybe try logging if it gets the onClick and onKeyPress. I would think that the tooltip shouldn't have a problem firing if those are getting triggered.

@nicolethoen nicolethoen dismissed stale reviews from dlabrecq, mcoker, and mcarrano via 82ae82b August 2, 2021 15:35
@nicolethoen nicolethoen force-pushed the tooltips_on_disabled_dropdown branch from 5149ac1 to 82ae82b Compare August 2, 2021 15:35
Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

Can you update the demo app.

@nicolethoen
Copy link
Contributor Author

I opened #6109 because tooltips on dropdown items are not screenreader accessible.

@@ -264,7 +267,7 @@ export class InternalDropdownItem extends React.Component<InternalDropdownItemPr
role={role}
onKeyDown={this.onKeyDown}
onClick={(event: any) => {
if (!isDisabled) {
if (!isDisabled && !isAriaDisabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can rewrite as isDisabled || isAriaDisabled to be more clear. de Morgan's theorem states !A && !B = A || B.

@redallen redallen merged commit 74ec097 into patternfly:main Aug 2, 2021
@patternfly-build
Copy link
Contributor

Your changes have been released in:

Thanks for your contribution! 🎉

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

Successfully merging this pull request may close these issues.

Support for tooltips on disabled dropdown items (aria-disabled variation)
9 participants