Conversation
|
@christiemolloy do you have a link for it that I could take a look at? :) |
|
@maryshak1996 just bumped the a11y count, hopefully it will pass! |
|
Deploy preview for pf-next ready! Built with commit c51ad9b |
|
Great job with this one! For comparison, I looked at these examples:
Let me know what you think about these options. We can also bring this up during the a11y review meeting to let others weigh in. |
| @@ -0,0 +1,6 @@ | |||
| <li class="pf-c-accordion__item{{#if accordion-item--IsExpanded}} pf-m-expanded{{/if}}{{#if accordion-item--modifier}} {{accordion-item--modifier}}{{/if}}" | |||
There was a problem hiding this comment.
The aria-expanded attribute should always be placed on the interactive element. So in this case, it should be moved from the <li> to the button.pf-c-accordion__item-button.
| @@ -0,0 +1,41 @@ | |||
| {{#> accordion}} | |||
| {{#> accordion-item accordion-item--attribute='aria-expanded="false"'}} | |||
| {{#> accordion-item-button accordion-item-button--attribute='aria-controls="ex-content-1"'}} | |||
There was a problem hiding this comment.
I know this is an attribute that's suggested in the wai-aria example for Accordion, but I lean toward only using this attribute for cases where the controlled contents do not immediately follow the toggle. I'd suggest to just remove this attribute altogether.
|
@christiemolloy this came out great! |
|
@jgiardino thanks for your comments... I made the respective updates. I agree with everything you mentioned, so its up to you if you want to bring them up in the a11y meeting - but I don't think they're too controversial. |
matthewcarleton
left a comment
There was a problem hiding this comment.
This is looking solid Christie.
Was there any discussion what the buttons would look like with longer strings of text? Right now it just breaks to a second line.
| @@ -0,0 +1,6 @@ | |||
| <ul class="pf-c-accordion{{#if accordion--modifier}} {{accordion--modifier}}{{/if}}" | |||
There was a problem hiding this comment.
Should this be a <dl>
There was a problem hiding this comment.
The wai-aria example uses <dl> but when I test their implementation in VO, I don't get any of the semantics associated with <dl>. I'm not sure if that's because they change the role of <dt> to a heading or not, but doing that seems to render the use of <dl> kind of pointless.
This implementation is also missing the <dt> element, and it might be worth checking in a screen reader what happens when you nest all the toggle elements like this:
<dt><h2><button class="pf-c-accordion__item-button" aria-expanded="false">...
instead of follow what wai-aria does with
<dt role="heading" aria-level="3"><button aria-expanded="true" ...>...
But I think it would also be fine just use <div>s for both .pf-c-accordion and .pf-c-accordion__item in this implementation, especially if the nesting suggestion above doesn't produce anything more meaningful in the screen reader experience.
There was a problem hiding this comment.
ya I was wondering why we couldn't use <dt> in place of the <h2> if we are going with the <dl>, <dd> structure
There was a problem hiding this comment.
I updated this to use <dl> > <div> > <dt> > <dd> We have the extra div because of the blue border on the left, but I could try rearranging the CSS to style this border without?
There was a problem hiding this comment.
ya you might be able to just style the border of the <dt> and the expanded <dd> rather than having the wrapping div. 🤔
There was a problem hiding this comment.
.pf-c-accordion-item as a <div> wrapper takes on accordion-item--IsExpanded and unassigns hidden to .pf-c-accordion-item-expanded-content. But that is because it is the parent of .pf-c-accordion-item-expanded-content . Without this div wrapper, .pf-c-accordion-item__button sits adjacent to .pf-c-accordion-item__expanded-contentand because they are siblings the expanded assignment doesn't work. However the wai-aria example uses js to toggle which item is hidden. So it seems to me that it needs this parent wrapper div to handle the expanded content in CSS. @matthewcarleton
|
|
||
| .pf-c-accordion { | ||
| // accordion | ||
| --pf-c-accordion--Width: #{pf-size-prem(300px)}; |
There was a problem hiding this comment.
I know this is coming from the design but are we saying that accordions couldn't be a different width? It would seem more likely that they would set the accordion width in the layout. What do you think?
There was a problem hiding this comment.
I agree. Not sure we can always predict the width of an accordion as it would be driven by layout and content.
There was a problem hiding this comment.
I was following the design, but I definitely agree that its layout should handle its width.
| --pf-c-accordion--BackgroundColor: var(--pf-global--BackgroundColor--light-100); | ||
| --pf-c-accordion--BorderWidth: var(--pf-global--BorderWidth--sm); | ||
| --pf-c-accordion--BoxShadow: var(--pf-global--BoxShadow--md); | ||
| --pf-c-accordion--PaddingTop: var(--pf-global--spacer--lg); |
There was a problem hiding this comment.
Looks like the design is calling for 32px here and the bottom.
| .pf-c-accordion__item { | ||
| position: relative; | ||
|
|
||
| &::before { |
There was a problem hiding this comment.
Have you tried writing this so you aren't applying all these to every item when they are aren't expanded?
There was a problem hiding this comment.
I had seen this done in data list, and I assumed this way would avoid the accordion item jittering when it expanded... but when I write this the other way it makes no difference. I guess we should be consistent with this across the all of pf - what do you recommend @matthewcarleton
There was a problem hiding this comment.
I'd say it's a more efficient way to write it, but maybe test it first to make sure 🤷♂️
There was a problem hiding this comment.
Okay it doesnt make a difference to this component so im in favor of the more efficient way :)
| | -- | -- | -- | | ||
| | `aria-expanded="false"` | `.pf-c-accordion__item` | Indicates that the expanded content element is hidden. **Required**| | ||
| | `aria-expanded="true"` | `.pf-c-accordion__item`, `.pf-c-accordion__item-expanded-content` | Indicates that the expanded content element is visible. **Required**| | ||
| | `hidden` | `.pf-c-accordion__item-expanded-content` | Indicates that the expanded content element is hidden.**Required** | |
There was a problem hiding this comment.
should we clarify that this should be used with aria-expanded="false"?
|
|
||
| | Class | Applied To | Outcome | | ||
| | -- | -- | -- | | ||
| | `.pf-c-accordion` | `<ul>` | Initiates an accordion component. **Required**| |
There was a problem hiding this comment.
I think this is going to be a <dl>
There was a problem hiding this comment.
Can you update this to a <dl>
| | Class | Applied To | Outcome | | ||
| | -- | -- | -- | | ||
| | `.pf-c-accordion` | `<ul>` | Initiates an accordion component. **Required**| | ||
| | `.pf-c-accordion__item` | `<li>` | Initiates a list item in the accordion component. **Required** | |
There was a problem hiding this comment.
I think this should be a <dt>
|
@matthewcarleton left some comments - also when the buttons reach a longer length the string truncates at a width of 90% - what do you think about that, at a width of 100% it runs into the toggle arrow. |
|
@christiemolloy I think that works. The only issue I see is when it's much wider 90% leaves quite a bit of space. That may be irrelevant though. I think this could actually work in the dropdown too, but would have to test to see. nice! |
matthewcarleton
left a comment
There was a problem hiding this comment.
Hey Christie, this is looking really close. I made a few final comments. The only other thing I wonder about is how it's documented. We don't document the <dt> or the <h3> but both are required either for semantic reasons of accessibilities reasons. Do you think they should be added?
| // This component always needs to be light | ||
| @include pf-t-light; | ||
|
|
||
| position: relative; |
There was a problem hiding this comment.
this can be removed
| .pf-c-accordion__button-text { | ||
| width: var(--pf-c-accordion__button-text--width); | ||
| overflow: hidden; | ||
| text-align: left; |
There was a problem hiding this comment.
this can be removed
There was a problem hiding this comment.
when I remove this it centers the content - its because of the width placed on the text when it truncates. so changed width to max-width
| --pf-c-accordion__button--hover--BackgroundColor: var(--pf-global--BackgroundColor--150); | ||
| --pf-c-accordion__button--focus--BackgroundColor: var(--pf-global--BackgroundColor--150); | ||
| --pf-c-accordion__button--active--BackgroundColor: var(--pf-global--BackgroundColor--150); | ||
| --pf-c-accordion__button--m-expanded--before--ZIndex: var(--pf-global--ZIndex--xl); |
There was a problem hiding this comment.
this can be removed
|
|
||
| | Class | Applied To | Outcome | | ||
| | -- | -- | -- | | ||
| | `.pf-c-accordion` | `<ul>` | Initiates an accordion component. **Required**| |
There was a problem hiding this comment.
Can you update this to a <dl>
| | `.pf-c-accordion__button-text` | `<span>` | Initiates the text inside the button. **Required** | | ||
| | `.pf-c-accordion__button-toggle` | `<span>` | Initiates the toggle inside the button. **Required** | | ||
| | `.pf-c-accordion__button-toggle-icon` | `<i>` | Initiates the toggle icon inside the toggle. **Required** | | ||
| | `.pf-c-accordion__expanded-content` | `<div>` | Initiates an expanded content. **Must be paired with a button** | |
There was a problem hiding this comment.
This should be a <dd>
| {{#if accordion-expanded-content--attribute}} | ||
| {{{accordion-expanded-content--attribute}}} | ||
| {{/if}}> | ||
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis molestie lorem lacinia dolor aliquet faucibus. Suspendisse gravida imperdiet accumsan. Aenean auctor lorem justo, vitae tincidunt enim blandit vel. Aenean quis tempus dolor. Lorem ipsum dolor sit amet, consectetur adipiscing elit Bla Bla Blee Bla. |
There was a problem hiding this comment.
can you move this out of here and into the examples. That way you can add extra content for the fixed example to show how it scrolls.
| @@ -0,0 +1,6 @@ | |||
| <div class="pf-c-accordion__item{{#if accordion-item--IsExpanded}} pf-m-expanded{{/if}}{{#if accordion-item--modifier}} {{accordion-item--modifier}}{{/if}}" | |||
There was a problem hiding this comment.
you can remove this file.
| @@ -0,0 +1,7 @@ | |||
| <span class="pf-c-accordion__button-toggle{{#if accordion__button-toggle--modifier}} {{accordion__button-toggle--modifier}}{{/if}}" | |||
There was a problem hiding this comment.
Is there any reason why you can't just have the .pf-c-accordion__button-toggle-icon ? I'd say we can take the same approach here as we do in the dropdown where we just use an icon and not need the wrapper.
There was a problem hiding this comment.
yep you're right!
|
thanks @matthewcarleton made updates! |
Closes #116.