Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(role): update roles to match React#5753

Merged
mcoker merged 4 commits intopatternfly:mainfrom
ashley-o0o:5385-roleupdate
Aug 3, 2023
Merged

fix(role): update roles to match React#5753
mcoker merged 4 commits intopatternfly:mainfrom
ashley-o0o:5385-roleupdate

Conversation

@ashley-o0o
Copy link
Contributor

closes: #5385

@patternfly-build
Copy link
Collaborator

patternfly-build commented Jul 11, 2023

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Just some quick updates needed below to resolve some a11y errors.

I'm also noticing that the deprecated Select has an a11y issue in the loading menu item example (linking to the staging site since it's pre-existing), since the <li> that contains the spinner doesn't have a role="option" child. This wasn't caught in React because the spinner is only present momentarily, whereas the HTML example it's persistent to showcase it.

We could do what the new Select is doing and update the markup so that the spinner is wrapped inside a .pf-v5-c-select__menu-item component, which would require React followup and possibly be slightly more significant a markup change. @mcoker what do you think? It feels more like a bug that needs resolving even though it's the deprecated select.

@@ -1,4 +1,4 @@
<li>
<li role="none">
<button class="{{pfv}}options-menu__menu-item{{#if options-menu-menu-item--modifier}} {{options-menu-menu-item--modifier}}{{/if}}"
Copy link
Contributor

Choose a reason for hiding this comment

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

These buttons should have role="option"

@@ -1,70 +1,70 @@
{{#> context-selector-menu-menu}}
<li>
<li role="menuitem">
Copy link
Contributor

Choose a reason for hiding this comment

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

For this file we'll want to update the li element to role="none", then within the context-selector-menu-list-item.hbs component we want to add the role="menuitem"

{{#> app-launcher-menu}}
<li>{{#> app-launcher-menu-item app-launcher-menu-item--attribute='href="#"'}}Link{{/app-launcher-menu-item}}</li>
<li>{{#> app-launcher-menu-item app-launcher-menu-item--type="button"}}Action{{/app-launcher-menu-item}}</li>
<li role="menuitem">{{#> app-launcher-menu-item app-launcher-menu-item--attribute='href="#"'}}Link{{/app-launcher-menu-item}}</li>
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to the above comment, we'd want to place this role on app-launcher-menu-item instead, then have this li element be role="none"

@mcoker
Copy link
Contributor

mcoker commented Jul 12, 2023

@thatblindgeye that sounds fine to me. From the sound of it, it doesn't seem like a breaking change on the core side, but would change the markup in the react component. I'm assuming that's OK outside of a breaking change release?

@thatblindgeye
Copy link
Contributor

For both Core and React it would only be changing the markup in that specific example (in React it's not something we provide via prop or anything, it's just an example showing how a consumer could set up a "view more" sort of loading item). So either way it doesn't sound like it'd be breaking to the component. cc @tlabaj just to confirm, though

@tlabaj
Copy link
Contributor

tlabaj commented Jul 12, 2023

For both Core and React it would only be changing the markup in that specific example (in React it's not something we provide via prop or anything, it's just an example showing how a consumer could set up a "view more" sort of loading item). So either way it doesn't sound like it'd be breaking to the component. cc @tlabaj just to confirm, though

@thatblindgeye I agree, this would not be breaking.

@ashley-o0o ashley-o0o requested a review from thatblindgeye July 13, 2023 15:30
Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Below are the comments I mentioned during our Meet, let me know if you have any questions!

I am noticing some other a11y issues being flagged by axe, specifically examples that are utilizing things like favorite buttons (issue being that it's causing a parent with role="menu" to have children with in invalid role), but this is an existing issue in both repos and would be out of scope of this PR. Mainly mentioning this in case it does cause the build to fail once the following updates are pushed.

Comment on lines 10 to 16
{{#if dropdown-menu--type}}
{{#ifAny dropdown-menu--template--Groups dropdown--template--MenuToggleImageText}}
role="menu"
{{/ifAny}}
{{else}}
role="menu"
{{/if}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we'd always want role="menu" to be present, except for the "Panel" example. What we could do is replace these conditionals with something like

{{#unless dropdown--HasCustomContent}}
  role="menu"
{{/unless}}

Then in the Panel example in the Dropdown markdown, pass dropdown--HasCustomContent="true" to the {{#> dropdown component

@ashley-o0o ashley-o0o requested a review from thatblindgeye July 18, 2023 19:09
Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Awesome job with these updates 🎉 Just had one more quick fix below (plus a question for the leads)

<li>
<button class="{{pfv}}options-menu__menu-item{{#if options-menu-menu-item--modifier}} {{options-menu-menu-item--modifier}}{{/if}}"
<li role="none">
<button role="option" class="{{pfv}}options-menu__menu-item{{#if options-menu-menu-item--modifier}} {{options-menu-menu-item--modifier}}{{/if}}"
Copy link
Contributor

Choose a reason for hiding this comment

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

@tlabaj @mcoker In React the roles are actually "menuitem" for this component, and "menu" for the options-menu-menu. Listbox and option are more appropriate, but it'd require a change in React.

Also, the "Multiple options" example has different markup in both repos. In Core the markup is an unordered list with nested unordered lists for each "group":

image

In React it's section elements for each "group" and an unordered list in each section:

image

This wouldn't be part of this PR, but do we want to align which deprecated markup should be used?

Copy link
Contributor

Choose a reason for hiding this comment

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

@thatblindgeye that would be fine with me. If the react markup is good, I think we should update the core markup since it's just documentation and less disruptive to users.

Copy link
Contributor

Choose a reason for hiding this comment

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

@mcoker @thatblindgeye I do not think we should update the react implantation unless it is a critical bug reported by a consumer since the component is deprecated.

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Opened followup issues, great job on this! 🎉

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.

🥸👍

@mcoker mcoker merged commit 6634cef into patternfly:main Aug 3, 2023
@patternfly-build
Copy link
Collaborator

🎉 This PR is included in version 5.1.0-prerelease.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@patternfly-build
Copy link
Collaborator

🎉 This PR is included in version 6.0.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

mattnolting pushed a commit to mattnolting/patternfly that referenced this pull request Dec 12, 2023
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.

Bug - lists: update roles to match React

5 participants