| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
PF3 preview: https://patternfly-react-pr-3645-pf3.surge.sh |
Sorry, something went wrong.
cc @jessiehuff
I'm curious what @tlabaj thinks about this. I'm not sure that we have a consistent way of doing this, and it often comes up in the PR when we give an element a class that doesn't have a corresponding style. The main reason we do it is that it helps build the BEM structure (creates a namespace for elements), and allows us to style those elements at some later point without requiring users update their markup to add a new class. That mostly applies to core users, since we can always add a missing class to a react component after the fact. |
Sorry, something went wrong.
There was a problem hiding this comment.
This looks good to me. @lboehling acn you also take a look?
Sorry, something went wrong.
|
@mcoker Added your bullets (minus the core one). I went with adding the tabindex="0" only to the anchor elements. @jessiehuff Let me know if I'm missing any other aria labels or tags that should be explicitly defined. I think in most cases using the ...props to pass these in should work. |
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## master #3645 +/- ##
==========================================
+ Coverage 71.22% 71.29% +0.07%
==========================================
Files 779 782 +3
Lines 10491 10528 +37
Branches 2263 2277 +14
==========================================
+ Hits 7472 7506 +34
- Misses 2592 2594 +2
- Partials 427 428 +1
Continue to review full report at Codecov.
|
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm, thanks!!
Sorry, something went wrong.
| /** Additional classes added to the SimpleList <ul> */ | ||
| className?: string; | ||
| /** Callback when an item is selected */ | ||
| onSelect?: (ref: React.RefObject<HTMLButtonElement> | React.RefObject<HTMLAnchorElement>) => void; |
There was a problem hiding this comment.
Instead of providing the button associated with clicking on each menu option, I'd prefer to provide my own ID. I can get the label from the button, but it's difficult to work with considering the label may be localized.
@dlabaj I believe we may be using SelectOption to help with this?
Sorry, something went wrong.
|
@mcarrano that's a bug from core. Just put up a PR to fix patternfly/patternfly#2679**** |
Sorry, something went wrong.
|
@kmcfaul the underline is fixed patternfly/patternfly#2679 (v2.59.1) |
Sorry, something went wrong.
|
@dlabrecq However, I could instead add another property to SimpleListItem that would be used to pass back data, instead of props. It would be clearer what gets passed back using this approach but would require extra user input to define the structure. Any thoughts about which approach would be better? |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for adding SimpleListItemProps
Sorry, something went wrong.
| import { css } from '@patternfly/react-styles'; | ||
| import styles from '@patternfly/react-styles/css/components/SimpleList/simple-list'; | ||
|
|
||
| export interface SimpleListGroupProps { |
There was a problem hiding this comment.
should extend HTMLProps for section
Sorry, something went wrong.
There was a problem hiding this comment.
I could only find React.HTMLProps<HTMLTableSectionElement>, would this be correct? It seems to work with the console logging warnings
Sorry, something went wrong.
There was a problem hiding this comment.
hm, how about passing <any> in this case since we just want the default HTML attributes
Sorry, something went wrong.
|
|
||
| const componentProps = isButton | ||
| ? { | ||
| type |
There was a problem hiding this comment.
just making sure this is intended, but type can be submit or reset as well if that's what's passed in as prop
Sorry, something went wrong.
There was a problem hiding this comment.
we want to make sure the default type is "button", this line lets the user change that if they wish. otherwise adding a type property manually would be caught by the component and not actually set.
Sorry, something went wrong.
There was a problem hiding this comment.
I'm not sure either way if we want to allow this
Sorry, something went wrong.
| return ( | ||
| <li className={css(listItemClassName)}> | ||
| <Component | ||
| className={css(styles.simpleListItemLink, isCurrentItem && styles.modifiers.current, className)} |
There was a problem hiding this comment.
className should be on the root element
Sorry, something went wrong.
There was a problem hiding this comment.
Moved these (className, props) to root element and added properties to customize the inner component.
Sorry, something went wrong.
There was a problem hiding this comment.
From an accessibility standpoint, it looks pretty good. Similar to what Coker was saying earlier, it would be beneficial to add an aria-labelledby. However, based on current recommendations, it looks like it should be added to the <ul>s though, for example here:

This aids the screen reader by being more descriptive about what that list is describing. In VO it will read "list, Group 1, 4 items" instead of "list 4 items" and not telling you which group you're under.
In terms of this pattern in other components like dropdown, app launcher, options menu, etc, I think more research and discussion would be beneficial. It can be a fine line between being descriptive and overusing aria which makes those decisions more challenging.
Great job, Katie! :)
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM! :)
Sorry, something went wrong.
There was a problem hiding this comment.
As a followup to @jessiehuff's and @mcoker's comments and based on my VO testing, there are a couple of things you can improve here and that we need to improve upstream.
Adding these attributes will announce that the parent .pf-c-simple-list is a list, how many sub-lists it contains and will remove titles from tabindex as they are announced when list is focused.
<div class="pf-c-simple-list" role="list" aria-label="Grouped list example">
<section class="pf-c-simple-list__section">
<h2 id="group-title-1" class="pf-c-simple-list__title" aria-hidden="true">Systems that are neat</h2>
<ul class="" aria-labelledby="group-title-1">
<li class="pf-c-simple-list__item">
<button class="pf-c-simple-list__item-link pf-m-current" type="button">List item 1</button>
</li>
<li class="pf-c-simple-list__item">
<button class="pf-c-simple-list__item-link" type="button">List item 2</button>
</li>
<li class="pf-c-simple-list__item">
<button class="pf-c-simple-list__item-link" type="button">List item 3</button>
</li>
<li class="pf-c-simple-list__item">
<button class="pf-c-simple-list__item-link" type="button">List item 4</button>
</li>
</ul>
</section>
<section class="pf-c-simple-list__section">
<h2 id="group-title-1 " class="pf-c-simple-list__title" aria-hidden="true">Group 2</h2>
<ul class="" aria-labelledby="group-2">
<li class="pf-c-simple-list__item">
<button class="pf-c-simple-list__item-link" type="button">List item 1</button>
</li>
<li class="pf-c-simple-list__item">
<a class="pf-c-simple-list__item-link" href="#">List item 2</a>
</li>
<li class="pf-c-simple-list__item">
<a class="pf-c-simple-list__item-link" href="#">List item 3</a>
</li>
<li class="pf-c-simple-list__item">
<button class="pf-c-simple-list__item-link" type="button">List item 4</button>
</li>
</ul>
</section>
</div>
Sorry, something went wrong.
|
I would also really like to see the component selectors manually added to the <li>s, but that's a larger discussion and not a blocker 😄 |
Sorry, something went wrong.
There was a problem hiding this comment.
This looks great!
Sorry, something went wrong.
|
Really great work @kmcfaul ! Only one more thing for me: If .pf-c-simple-list doesn't contain child .pf-c-simple-lists, you don't need role="list". |
Sorry, something went wrong.
There was a problem hiding this comment.
🔥 LGTM! Nice work!
Sorry, something went wrong.
|
Your changes have been released in:
Thanks for your contribution! 🎉 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
What: Closes #3610
@mcoker It appears that pf-c-simple-list__list and pf-c-simple-list__list-item do not exist/are not in use despite appearing on the HTML structure in core. Let me know if I should add them manually, but currently I have left them off.