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

smaller css #82

Closed
Aranjedeath opened this issue Mar 1, 2017 · 3 comments
Closed

smaller css #82

Aranjedeath opened this issue Mar 1, 2017 · 3 comments

Comments

@Aranjedeath
Copy link

Aranjedeath commented Mar 1, 2017

I'm not sure if this is a bug or not, but I just wanted to give back based on my use of the project.

Because I already have a normalize.css loaded, I was able to delete almost the entire css. The following leaves bit-exact perfectly functioning tabby.

.js-tabby .tabs-pane:focus {
    outline: none
}

.js-tabby .tabs-pane:not(.active) {
    display: none;
}

hope it helps

it's live on my site

@cferdinandi
Copy link
Owner

You've made your content inaccessible to a lot of people with these changes.

Tabby forgoes aria roles in favor of simple, progressively enhanced anchor links. There are a few aspects to this approach.

First, don't use display: none. It hides content completely from screen readers.

Tabby deliberately uses a more verbose set of CSS that only visually hides the content. Someone viewing the site via a screen reader simply sees anchor links and navigates through the full set of content.

Another important part of how Tabby works is keyboard navigation. If I tab into a closed content area that contains a link, that content area should become active (check out the demo to see what I mean).

Again, display: none prevents this from happening, as the content area is removed from the tab flow.

The tabby CSS, minified, is 322 bytes. That's less than 1/3rd of a KB. Gzipped, it's probably closer to 100 bytes.

To save just a few bytes, you're making your site far less accessible.

@Aranjedeath
Copy link
Author

OK. I didn't know display:none; had any effect on screen readers (I didn't know they didn't just read the code directly, which would facilitate ignoring things like display:none;). I now want to punch a standards committee member. Thanks for your response.

@cferdinandi
Copy link
Owner

That's actually by design, and makes quite a bit of sense. If you're saying that a piece of content should not be displayed, why would you want a screen reader to read it? You're effectively "removing it" from the DOM.

Hence the visually hidden technique.

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

No branches or pull requests

2 participants