-
Notifications
You must be signed in to change notification settings - Fork 311
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
Adding tabs #32
Adding tabs #32
Conversation
style.css
Outdated
@@ -478,3 +483,45 @@ summary:focus { | |||
width: 16px; | |||
background-image: svg-load("./icon/button-right.svg"); | |||
} | |||
|
|||
menu.tabs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incredible work 😍
While you're still hacking on this, wanna rework these selectors to guarantee proper aria attributes?
That is:
- instead of
.tabs
we could do[role=tablist]
- instead of
.tabs li
we could do[role=tab]
[aria-selected]
instead ofli,active
Happy to nitpick but just wanted to drop this in early :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some exit criteria could be: does this render reach-ui's Tabs without any extra effort? https://codesandbox.io/s/rough-tree-ghm6v. Multiline could still be an extra class though.
We could then reference that in the docs :) Tabs is spec-compliant (and reviewed by some strong a11y talent!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy that. I'll change these for arias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some exit criteria could be: does this render reach-ui's Tabs without any extra effort? https://codesandbox.io/s/rough-tree-ghm6v. Multiline could still be an extra class though.
We could then reference that in the docs :) Tabs is spec-compliant (and reviewed by some strong a11y talent!)
I do not know about this library. For testing i made mines in Vue like so
<menu role="tablist">
<li role="tab" v-for="(tab, key) in tabs" :key="key" :aria-selected="key == active" @click="active = key">
<a href="#" v-text="tab"></a>
</li>
</menu>
<div class="window" role="tabpanel">
<div class="window-body">
<!-- some random lipsum content -->
</div>
</div>
<script>
const app = new Vue({
el: '#app',
data: {
active: 0,
tabs: ['Desktop', 'My computer', 'Control panel', 'Devices manager', 'Hardware profiles', 'Performance']
}
})
</script>
This is what renders what i captured above.
I don't think that it should be called multirole. Surely justified can be used on single row tabs to grow them to fit the tabs full width? |
Yes indeed. |
Hello. Style.css has been updated. Now with [role] and [aria-selected]
<menu role="tablist">
<li role="tab" aria-selected="true"><a href="#">Desktop</a></li>
<li><a href="#">My computer</a></li>
<li><a href="#">Control panel</a></li>
<li><a href="#">Devices manager</a></li>
<li><a href="#">Hardware profiles</a></li>
<li><a href="#">Performance</a></li>
</menu>
<div class="window" role="tabpanel">
<div class="window-body">
<!-- the tab content -->
</div>
</div>
I still have documentation to update once we reach a satisfying state. |
Heya @CaptainFalcon92, Great work here :) I have two bits of feedback:
https://codesandbox.io/s/affectionate-merkle-evqnl?file=/src/App.js The reason being that reach-ui has been audited extensively, and it's been my go-to for building tablists in React lately. This library is not React-specific, but that tab markup is just a byproduct.
|
I'm happy to write some docs for this btw! You've put in lots of hard work already and I appreciate it very much |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More aria Qs
Hey, So i've refactored the tabs in XP.css as you've suggested to use aria labels. My HTML structure looks like this (removed all the parameters that don't affect styling):
I have gone with buttons rather than a list with links as recommended in the MDN web docs for ARIA: tab role. Here's a link to the XP.css branch with the updated tabs: I'd like to keep XP.css backwards compatible with 98.css, what have you decided on as your markup structure for the tabs component? |
Looks like this closed because I deleted the master branch in favor of |
Hi @CaptainFalcon92 @jdan Can we reopen this PR and if it looks good get it merged. There is need for this and also table with fixed header and scrollable body. @CaptainFalcon92 Could you provide us with a working fiddle |
Hello. |
This is a first try at reproducing W98 tabs - #21
I looked at how tabs behaves in W98 and it looks like normal tabs are justified left.
Then only when tabs become multi-rows then they are justified in full width.
Also i think i remember the row where belongs the active tabs is always pulled down, isn't it ?
Here are some single row tabs
And some multi-rows tabs
Here is the HTML
For multi-row you can use
.tabs.justified
.Although now i think it should be called
.multirows
.Given i tried to reuse the
.window
as a tab container i had to find some hacks and made use of z-index in order to pull the active tab upfront and cover the container borders.Is there a reason why the borders are made with box-shadows instead of real borders ?
Best 🙂