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(accordion): add two variations of html markup #1990

Merged
merged 3 commits into from
Jun 27, 2019

Conversation

christiemolloy
Copy link
Member

closes #1913

@patternfly-build
Copy link

patternfly-build commented Jun 26, 2019

Deploy preview for pf-next ready!

Built with commit 45b04ad

https://deploy-preview-1990--pf-next.netlify.com

Copy link
Contributor

@mattnolting mattnolting left a comment

Choose a reason for hiding this comment

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

Great work, I'd just add commas to documentation.

@@ -15,11 +21,11 @@

| Class | Applied to | Outcome |
| -- | -- | -- |
| `.pf-c-accordion` | `<dl>` | Initiates an accordion component. **Required**|
| `.pf-c-accordion__toggle` | `<dt><h3><button>` | Initiates a toggle in the accordion. **Required** |
| `.pf-c-accordion` | `<div>` `<dl>` | Initiates an accordion component. **Required**|
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| `.pf-c-accordion` | `<div>` `<dl>` | Initiates an accordion component. **Required**|
| `.pf-c-accordion` | `<div>`, `<dl>` | Initiates an accordion component. **Required**|

| `.pf-c-accordion` | `<dl>` | Initiates an accordion component. **Required**|
| `.pf-c-accordion__toggle` | `<dt><h3><button>` | Initiates a toggle in the accordion. **Required** |
| `.pf-c-accordion` | `<div>` `<dl>` | Initiates an accordion component. **Required**|
| `.pf-c-accordion__toggle` | `<h3><button>` `<dt><button>` | Initiates a toggle in the accordion. **Required** |
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| `.pf-c-accordion__toggle` | `<h3><button>` `<dt><button>` | Initiates a toggle in the accordion. **Required** |
| `.pf-c-accordion__toggle` | `<h3><button>`, `<dt><button>` | Initiates a toggle in the accordion. **Required** |

| `.pf-c-accordion__toggle-text` | `<span>` | Initiates the text inside the toggle. **Required** |
| `.pf-c-accordion__toggle-icon` | `<i>` | Initiates the toggle icon. **Required** |
| `.pf-c-accordion__expanded-content` | `<dd>` | Initiates expanded content. **Must be paired with a button** |
| `.pf-c-accordion__expanded-content` | `<div>` `<dd>` | Initiates expanded content. **Must be paired with a button** |
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| `.pf-c-accordion__expanded-content` | `<div>` `<dd>` | Initiates expanded content. **Must be paired with a button** |
| `.pf-c-accordion__expanded-content` | `<div>`, `<dd>` | Initiates expanded content. **Must be paired with a button** |

@mattnolting
Copy link
Contributor

Lgtm 👍

@jgiardino
Copy link
Contributor

jgiardino commented Jun 27, 2019

Thanks for updating this!!

Off-thread, @christiemolloy had asked about what the default variation should be, between the one with definition list and one with headings. My understanding with the react component is that if headingLevel is not included, then the definition list variation would be used. If headingLevel is specified, then we use the variation with headings and use the heading level specified in that prop. In that case, I think the variation with definition list would be considered the default, at least in the context of react. In the context of core, do we have a concept of default? Do our defaults in react mean anything in the context of core? I'm a little inclined to say that what's more important is we match examples and example order between the two. And the first react example doesn't have to be the variant that uses defaults.

I'm curious what others think, but in this example, I think we can leave the order as it is, and have the react examples updated to match the examples shown in core.

Other than that question, there's one minor issue I noticed when I expanded the code for the preview of the <dl> variation, where an extra </dt> is included:

  <dt>
    <button class="pf-c-accordion__toggle" aria-expanded="false">
      <span class="pf-c-accordion__toggle-text">
   Item one</span>
      <i class="fas fa-angle-right pf-c-accordion__toggle-icon" aria-hidden="true"></i>
    </button>
    </h3>
  </dt>
  </dt> <<<<<< EXTRA </dt> HERE
  <dd class="pf-c-accordion__expanded-content" hidden>
    <div class="pf-c-accordion__expanded-content-body">
      This text is hidden
    </div>
  </dd>

And a similar issue occurs in the example that uses <h3>:

<div class="pf-c-accordion">
  <h3>
    <button class="pf-c-accordion__toggle" aria-expanded="false">
      <span class="pf-c-accordion__toggle-text">
   Item one</span>
      <i class="fas fa-angle-right pf-c-accordion__toggle-icon" aria-hidden="true"></i>
    </button>
  </h3>
  </dt>   <<<<<< EXTRA </dt> HERE
  </h3>   <<<<<< EXTRA </h3> HERE
  <div class="pf-c-accordion__expanded-content" hidden>
    <div class="pf-c-accordion__expanded-content-body">
      This text is hidden
    </div>
  </div>

@@ -1,5 +1,11 @@
## Overview

The accordion component can be built in two different ways.
The default way uses `<div>` and `<h3>` tags to build the component.
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 my previous comment, I'm not sure that we want to label anything in core as a default, since the concept of defaults doesn't really exist here the way they do in the react repo. In react, there are defaults based on empty props, and for this component, I think the default variation would be the definition list variation.

Here, I would just say that one variation uses definition list and another uses headings. And also that we are using <h3> but really the heading levels that you use should fit within the rest of the heading outline on your page.

| `.pf-c-accordion` | `<dl>` | Initiates an accordion component. **Required**|
| `.pf-c-accordion__toggle` | `<dt><h3><button>` | Initiates a toggle in the accordion. **Required** |
| `.pf-c-accordion` | `<div>`, `<dl>` | Initiates an accordion component. **Required**|
| `.pf-c-accordion__toggle` | `<h3><button>`, `<dt><button>` | Initiates a toggle in the accordion. **Required** |
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is the only <button> in the accordion, maybe we can change this:
<h3><button>, <dt><button>
to just be this:
<button>

One benefit of this is not having to explain that the <h3> should really be a heading level that fits the rest of the heading outline on your page.

Copy link
Member Author

Choose a reason for hiding this comment

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

per our offline conversation, updating this to be <h1 - h6>

@christiemolloy
Copy link
Member Author

Updated @jgiardino

Copy link
Contributor

@jgiardino jgiardino left a comment

Choose a reason for hiding this comment

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

Everything looks good! 🎉 Thanks!

@mattnolting mattnolting merged commit aa6b851 into patternfly:master Jun 27, 2019
@patternfly-build
Copy link

🎉 This PR is included in version 2.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

4 participants