Skip to content

feat(pfTabs): enhance pf-tabs api - #67

Open
priley86 wants to merge 1 commit into
patternfly-webcomponents:masterfrom
priley86:pf-tabs-updates
Open

feat(pfTabs): enhance pf-tabs api#67
priley86 wants to merge 1 commit into
patternfly-webcomponents:masterfrom
priley86:pf-tabs-updates

Conversation

@priley86

@priley86 priley86 commented Aug 9, 2017

Copy link
Copy Markdown
Contributor
  • enhance pf-tabs API to support DOM nodes within the tabs
  • enhance pf-tabs API to support multiple contents via new pf-tab-content CE
  • enhance pf-tabs to support pf-dropdown tab items
  • enhance pf-tabs test page to include several style variations and dynamic contents example
  • enhance pf-dropdown to support non button dropdown toggles (such as a rendered by pf-tabs)

test page:
https://rawgit.com/priley86/patternfly-webcomponents/pf-tabs-updates-dist/app/app.html?dir=pf-tabs&file=index.html

stackblitz:
https://using-pf-tabs-in-reactjs.stackblitz.io/

Closes #60

@priley86 priley86 changed the title feat(pfTabs) enhance pf-tabs api feat(pfTabs): enhance pf-tabs api Aug 14, 2017
@priley86

Copy link
Copy Markdown
Contributor Author

rebased w/ latest and ensured semantic-release commit...

@cdcabrera cdcabrera left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good overall, just 2 minor annotation pieces and some general question/comments.

Found some minor annotation updates

Some CSS observations...
Separating the tab panels out from my perspective means we could relax the CSS associated with the content panels. Right now it's kind of strict around how it should be formatted. Could relaxing it be a thing we want to investigate?

Some accessibility extra...
We use some Aria attributes on the panels, would providing something in addition like "aria-live=polite" conflict with anything?

@priley86

priley86 commented Aug 14, 2017

Copy link
Copy Markdown
Contributor Author

@cdcabrera +1 to annotation fixes and good catch on those. I've attempted to make them more relevant...

Regarding the content panels, I thought that making a wrapping element and just using it to enhance accessibility attributes would be an OK pattern. However, we could easily adopt something else. Main thing this approach attempts to support though is having the ability to activate multiple content panels on selecting a tab, and enabling flexibility of where that content is located. If you have another proposal or you'd like to suggest something, maybe a PR in the future? I'm always up for supporting more use cases...

Re: accessibility. I believe Andres suggested some other attributes as well (although I'm not sure which). Happy to revisit this, but attempted to follow the guidelines used on the VMWare Clarity tabs here...
https://vmware.github.io/clarity/documentation/tabs

cdcabrera
cdcabrera previously approved these changes Aug 14, 2017
@priley86

priley86 commented Aug 15, 2017

Copy link
Copy Markdown
Contributor Author

@jgiardino has proposed an additional feature for allowing right-aligned content (alongside the left-aligned tabs). we will need to review this rendered HTML with the CSS group and determine if this is an accepted pattern for PF.

less:

.pf-tabrow {
  display: flex;
  flex-wrap: wrap-reverse;
  & > li {
    float: none;
  }
  & > .pf-tabrow-contents {
    margin-left: auto;
  }
}

html

<ul class="nav nav-tabs pf-tabrow">

            <li class="active"><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fpatternfly-webcomponents%2Fpatternfly-webcomponents%2Fpull%2F67%23">Tab One</a></li>
            <li><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fpatternfly-webcomponents%2Fpatternfly-webcomponents%2Fpull%2F67%23">Tab Two</a></li>
            <li><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fpatternfly-webcomponents%2Fpatternfly-webcomponents%2Fpull%2F67%23">Tab Three</a></li>
            <li><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fpatternfly-webcomponents%2Fpatternfly-webcomponents%2Fpull%2F67%23">Tab Four</a></li>
            <li><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fpatternfly-webcomponents%2Fpatternfly-webcomponents%2Fpull%2F67%23">Tab Five</a></li>
            <li class="pf-tabrow-contents">
              <button class="btn btn-default" type="button">Secondary</button>
              <button class="btn btn-primary" type="button">Primary</button>
              <button class="btn btn-danger" type="button">Destructive</button>
            </li>
          </ul>

I tend to think providing a pf-tab-row-contents CE would be a good addition for allowing this. thoughts?

i guess too, that we prefer to keep tabs left aligned, so allowing buttons or other content on the right hand side doesn't seem so bad i.m.h.o.

cc: @cdcabrera @srambach @andresgalante

@priley86

Copy link
Copy Markdown
Contributor Author

also @jgiardino - can you speak to the responsiveness of this approach?

@jgiardino

jgiardino commented Aug 16, 2017 via email

Copy link
Copy Markdown
Collaborator

@priley86

priley86 commented Aug 17, 2017

Copy link
Copy Markdown
Contributor Author

fair enough @jgiardino...i think we're OK to add this, knowing that it will just aid in flexibility for certain product use cases (and that it will likely be customized).

Sooo.. i'll add a pf-tabrow-contents CE which renders an li and has an overridable class. It sounds like this will meet your product need for now. I'm open to extending this in the future...

I should have this ready some time tomorrow.

@priley86
priley86 force-pushed the pf-tabs-updates branch 4 times, most recently from 317250b to b92fe93 Compare August 19, 2017 13:01
* enhance pf-tabs API to support DOM nodes within the tabs
* enhance pf-tabs API to support multiple contents
* enhance pf-tabs to support pf-dropdown tab items
* enhance pf-tabs test page to include several style variations and dynamic contents example

Closes patternfly-webcomponents#60
@priley86

priley86 commented Aug 19, 2017

Copy link
Copy Markdown
Contributor Author

@jgiardino @cdcabrera i've added support for pf-tab-row-contents. Please see updated code and links below for how one can use these components alongside a framework, such as React.

https://stackblitz.com/edit/using-pf-tabs-in-reactjs?file=index.js
https://using-pf-tabs-in-reactjs.stackblitz.io/

https://rawgit.com/priley86/patternfly-webcomponents/pf-tabs-updates-dist/app/app.html?dir=pf-tabs&file=index.html

Due to the nature of this approach with transcluded content and framework interop/Mutation Observers, I will be following up shortly in an email with some of my research alongside this PR.

Comment thread src/pf-tabs/index.html
<pf-tab content-id="example-four-tab-two">Tab Two</pf-tab>
<pf-tab content-id="example-four-tab-three">
<pf-dropdown class="dropdown" id="dropdown1">
<a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think attribute "data-***" is specific for bootstrap, it should not appear in patternfly-webcomponents

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.

4 participants