Author: Jerry Jones

  • Extensively Extending Sass @extend: How I Overused Extends

    Right now, I believe CSS should be minimal, meaningful (to people), and not descriptive of what it looks like (visually). Also, I can be a bit of an idealist. Especially at the beginning of a project.

    As a warning, this post isn’t meant to teach basic CSS concepts. Get ready for some CSS nerdery.

    Project Overview: BEM and Utility %placeholders

    I’m using BEM (Block, Element, Modifier) syntax, and it’s amazing. I can build a solid component marked up with one or two BEM classes per element, keep my Sass mostly un-nested to avoid specificity issues, and the HTML looks clean.

    But, utility CSS classes are sooooo handy. Want it to be smaller text? We have a class for that called .small. Align it to the right? How about something elegantly named .align-right? Want it a different color? Maybe, .blue? or .green? Just add a class to your HTML and we’re done!

    Well, at some point, I’d rather write my CSS by hand in a CSS file. Not to mention, that HTML is no longer so fresh, so clean.

    How to get the best of both worlds? Lots and lots of %placeholders in my CSS. All of the %placeholders. So those utility classes become Sass %placeholders that I @extend.

    This all still sounds so fresh, so clean. Here’s where it gets uglier.

    You can’t use Sass extends inside media queries.

    Well, you can, but it gets hairy. I used Hugo Giraudel’s Cross-Media Query @extend Directives in Sass to work around the issue, and his solution is pretty clever and hard to understand. I’m not going to attempt to explain it. Using his method in place of the default %placeholder, I could use his @include _(‘foo’); inside my pre-defined breakpoints like this:

    @include placeholder('font--small') {
       font-size: 0.8rem;
    }
    
    @include placeholder('font--large') {
       font-size: 2.8rem;
    }
    
    // why I don't like visually descriptive
    // classes in HTML
    
    .big-thing {
        @include _(font-small);
    
        @include breakpoint(medium) {
            @include _(font--large);
        }
    }
    

    Extending Extends of Extends to Extend their Extensiveness

    Quick note. This is supposed to be overly contrived. The point is, I’m abusing placeholders and hoping they’ll operate like a @mixin, which they clearly don’t. Skip to Wait, What? if you’re already convinced.

    So, If I’m using @extends as utilities, why shouldn’t I @extend my extends? I mean, besides that I’m blatantly ignoring how they’re supposed to work and hoping things will turn out OK. Let me give you an example.

    @include placeholder('icon--blue-bg') {
        background: $blue;
        fill: #fff;
    }
    
    @include placeholder('icon--circle') {
        border-radius: 50%;
        @include _(icon--blue-bg);
    }
    
    @include placeholder('icon--white-bg') {
        background: #fff;
        fill: $blue;
    }
    
    @include placeholder('icon--normal') {
        width: 1.2rem;
        height: 1.2rem;
    }
    
    @include placeholder('btn--icon__icon--circle') {
        @include _(icon--circle);
        @include _(icon--white-bg);
        @include _(icon--normal);
        margin-left: 0.5em;
        position: relative;
        top: 0.15rem;
    }
    
    .btn--icon__icon--circle {
        @include _(btn--icon__icon--circle);
    }
    

    That’s %placeholders three levels deep and BEM to the max, y’all. That last class, .btn--icon__icon--circle means “a button that has an icon and this is styling the icon within that button, and the icon should be in a circle”. Whew.

    So, that all kind of makes sense? Maybe? Right?

    The issue is, that once you apply that placeholder to something and want to override it, the CSS specificity gets weird. The specificity is now applying to the location of your placeholders because of how Sass compiles @extends. So, if I wanted to make a button icon have a circle, but I actually want that circle to be a blue background?

    I’d just use my icon--blue-bg placeholder! Easy. Right?

    .btn--icon__icon--circle--blue {
        @include _(btn--icon__icon--circle);
        @include _(icon--blue-bg);
    }
    

    Nope.

    The issue is that the placeholder('icon--blue-bg') has to come after the placeholder('icon--white-bg'). _('icon--blue-bg') can never override _('icon--white-bg'). I’ve introduced specificity into order of the %placeholders. Not at all what I wanted to do.

    Wait, what?

    To review, I used these weird placeholder @includes to replace Sass’s default %placeholders so I could use @extends inside of media queries so I could keep my HTML so fresh and so clean.

    I wish I had typed that awful sentence before I did all the work to incorporate it. Maybe that would have shown me that I was over-engineering something in the pursuit of idealism.

    As my friend Jonathan Vieker says, “What would this look like if it were easy?”. Well, Jonathan, certainly not this.

    But, That’s Just Your Weird @include placeholder(‘stuff’)!

    That’s what I was hoping, too. The same specificity issue still applies with good ol’ placeholders. Check this:

    %font--large {
      font-size: 2.8rem;
    }
    
    %font--small {
      font-size: 1rem;
      @extend %font--large;
    }
    
    .extend-big {
      @extend %font--small;
      @extend %font--large;
    }
    

    Obviously this is really contrived (but not really once you’re using breakpoints). Will .extend-big be small or large? Any guess?

    It’s small. SMALL, I SAY!

    The specificity isn’t about when you apply it to the .extend-big class, it’s about the location of the @extend itself. So, want to make it large? Don’t worry about changing the order on the .extend-big class, you have to change the order of the %placeholders themselves like this:

    %font--small {
      font-size: 1rem;
      @extend %font--large;
    }
    
    %font--large {
      font-size: 2.8rem;
    }
    
    .extend-big {
      @extend %font--small;
      @extend %font--large;
    }
    

    Now .extend-big will be large.

    Here’s a codepen for you to play around with to see it in action:

    See the Pen Extensively Extending Sass Extends by Jerry Jones (@jeryj) on CodePen.

    //assets.codepen.io/assets/embed/ei.js

    How I Could Have Made it Easy

    You know what you can use inside of a media query and not worry about specificity? Yup. A @mixin. I knew that before I started. But I wanted so fresh, so clean! What I got was a headache of vague specificity.

    For my next project, my current plan is to use @mixins as utility classes, and then use CSSO with Gulp to trim down the CSS, effectively doing what my elusive ideal %placeholder would have done.

    Here’s an example using the same example above but with @mixins and CSSO.

    @mixin font--large {
      font-size: 2.8rem;
    }
    
    @mixin font--small {
      font-size: 1rem;
      @include font--large;
    }
    
    .mixin-big {
      @include font--small;
      @include font--large;
    }
    
    // just to contrive it more for good measure,
    // let's add another class
    
    .csso-mixin-big {
      @include font--large;
    }
    

    .mixin-big is actually large like you’d think it’d be. Here’s what it compiles to in Sass, before hitting CSSO:

    .mixin-big {
      font-size: 1rem;
      font-size: 2.8rem;
      font-size: 2.8rem;
    }
    
    .csso-mixin-big {
      font-size: 2.8rem;
    }
    

    Not so fresh, so clean. Let’s run it through CSSO:

    .csso-mixin-big,
    .mixin-big{
        font-size: 2.8rem;
    }
    

    So fresh, so clean! So fresh, so clean!

    Andre 3000 and Big Boi from Outkast busting sweet moves in their video for So Fresh, So Clean

    I haven’t tried this with a complex project or nested in lots of weird breakpoints, so I don’t know how well it’ll work. I haven’t stress tested it yet.

    But rest assured, when I do, I’ll write a post called “How I overused @mixins and CSSO”.

  • 6 Questions to Ask Yourself Before Working for Free

    It’s tempting to work for free or with steep discounts for friends and nonprofits, but there are some pitfalls to be aware of. If you can get to the end of these questions and feel great about designing a logo, building a website, or whatever it is you do, then by all means, go for it.

    1. Did they say it’d be a “portfolio builder”?

    No. Nope. Definitely not. Don’t even bother responding. If they think they’re doing you a favor by letting you have a chance to work for free, then it’s not going to end well.

    2. Will you be OK with your work being under valued and not appreciated?

    People will generally appreciate that you built them something that they had no idea how to do, but probably not on the level you want them to. They don’t know how hard you work, or all the considerations that go into your designs and websites, and they’re not supposed to. That’s your job.

    It’s hard to fully appreciate something when you don’t know the intricacies of it. Couple that with doing the work for free/cheap, and you’re basically teaching someone that your time isn’t of much value. You have to be OK with this or have a strategy to make sure your time is valued.

    3. Will you be proud of the end result?

    I work hard on all my projects, but it’s not realistic to put the same level of care and detail into a free project. Is it OK? Yeah. Does it work? Of course. Is it something I want to put in my portfolio… eh… sometimes.

    If you’re not willing or able to put in your full effort, then maybe it’s better to let the project go.

    4. Can you give them the attention they need?

    You might see their project as a simple task and understand every step that needs to be taken. They probably don’t. This might be the first business they’ve started, or a project they’re pouring their life into. If you’re not able to meet them where they’re at, then it’s probably best to pass.

    5. Can you say no?

    If you can’t tell them “no” now, then it’s going to be even harder to say no 3 months from now when they’re still trying to expand the scope of the project. Pair that with someone not valuing your time, and you’ve got a sticky situation.

    6. Will you be able to support the project down the road?

    Just because you’re doing free work now, is it still free work 9 months from now when the site gets hacked? What about if they change the tagline on their logo and need updated business cards? If it’s free for them now, why wouldn’t it always be free?

    You’re eventually going to be put into a spot where you have to charge them for your time or say no. It’s not going to be easy, and you will both walk away feeling badly about the situation. Not so great for something that started with good intentions.

    It is possible

    This article isn’t meant to convince you that you should never do free or cheap work. The article is about making sure that at the end of the project, everyone is happy with the outcome.

    Clear communication and firm boundaries are key. Make sure your time is valued, your work is appreciated, and that you have the availability down the road to keep helping out (or a firm end of project/limit to your work) and things will hopefully turn out alright for everyone.

  • 7 Easy Steps to Fail at Building a Network

    For most of my career, I’ve felt like an imposter. I didn’t think I knew enough to contribute to the web designer/dev community, so why would anyone want to network with me? If I tried, wouldn’t people just figure out I didn’t know as much as them?

    I used to believe this was true. As a result, I’m just now starting to build a professional network. If you want to fail at networking like I had, follow these 7 easy steps!

    1. Figure Everything Out on Your Own

    Every project I start, I learn something new. This develops great problem solving skills at the expense of networking. I could have asked questions on Stack Overflow, but, instead, I slogged away for hours on my own.

    I’ve asked a total of three questions on Stack Overflow in my career. Every time I do, I’m welcomed by intelligent, helpful people that work with me to figure out a solution. If I’d been more willing to ask for help, I’d have met more great designers and devs along the way.

    2. Feel Like an Imposter

    My biggest struggle as a designer/developer is feeling like an imposter. It wasn’t until 6 years of making my income as a designer/developer that I finally felt like I could even call myself a designer.

    I’m going to let you in on a little secret: Everyone feels like an imposter.

    You may not be the best at what you’re doing, but you’re doing it, so have the confidence to allow yourself to be a part of a network.

    3. Don’t Write about What You’ve Learned

    It’s hard to write an article or share your opinion when you feel like an imposter and you know there are people out there that know a ton more than you.

    Why would anyone read what you write? Won’t people tear it to shreds?

    Well, frankly, it’s likely no one will read your article. But that’s not the point. The point is, that writing will make you more confident in your abilities, shape your ideas, and prove to yourself that you have ideas to contribute.

    4. Don’t Be on Twitter

    Before I joined Twitter, I only read articles that were directly related to the problem I was trying to solve.

    Using Twitter, I’ve learned about new techniques, best practices, and interacted with great people. Also, it’s a big confidence boost when other designers/devs follow you or retweet something you said. Don’t expect that to happen overnight or even much at all. It’s slow to get the ball rolling if you don’t post much and don’t have many followers.

    5. Live in a Small Town

    I’m one of three professional designers and/or devs in the town I live in. I’m going out on a limb here, but if your “network” is a shape easily drawn by a three-year-old, then it doesn’t count as a network.

    I’m not saying it’s impossible to network while living in a small town, but you’re going to have to put more effort in. There aren’t meet-ups to attend, conferences to go to, or tech-oriented companies to work for.

    6. Don’t Attend Conferences

    I’ve never been to a conference. They can be cost-prohibitive for freelancers. I really want to go and meet a bunch of people who are as excited about web design and development as I am.

    Quick shameless self-promotion: I’d love to try speaking at a conference. Send me a message if you think I’d be a good fit for your conference.

    7. Immediately Start A Freelancing Business

    I started web development and design by accident, and started picking up gigs on the side. I’ve never worked as an employee of an agency or company. The ability to set my own schedule and work on projects I’m passionate about is better than I could have expected. The downside… For six years, I didn’t have any professional peers. No co-workers. Everything was up to me.

    I’d love to work with a bunch of smart people, learn from them, and create amazing things together. In the last 6 months, I’ve been fortunate to be a part of a small team at the Engaging News Project and work with fantastic, intelligent people. We push each other to make better products, and I’ve become a better designer and developer as a result.

    It Takes Effort

    Yeah, this article is called “7 Easy Steps to Fail at Building a Network,” but I need a positive takeaway, right?

    It takes effort to build a network. Most of my career I just pretended it wasn’t important. Since trying to develop a network, I’ve become a better designer, developer, and person. And it’s fun to meet new people that are excited about the same things you are.

    If you think I’d be a good part of your network, reach out to me. Because I’d sure like to be a part of yours.

    Do you have any good tips for people trying to grow their network (including me)?

  • How to Get Started as a Web Developer

    I became a designer and developer by baking bread.

    Wait… let me start over.

    I accidentally became a web designer/developer by baking bread.

    Here’s how it happened:

    1. Get a BA in Creative Writing and an MA in Elementary Education
    2. Learn how to make great sourdough breads
    3. Sell bread and my wife’s granola bars (best bars this side of the Mississippi) at the Farmer’s Market
    4. Make a legit business and call it The Covert Cupboard
    5. Illustrate a logo of a bird wearing Groucho Marx glasses and a mustache
    6. Check out a book on HTML/CSS from the library
    7. Stay up until 2am every night trying to figure out what all these acronyms mean (CSS/HTML/JS/FTP)
    8. Have someone see the site, and say, “Hey! Can you make me a website?” and respond with a resounding, “Um… Maybe?”

    You can try following these steps if you want, but your mileage may vary. If you want more reliable results, try some of these tips instead.

    Learn the Basics

    There are a lot of tools and frameworks (like WordPress) that make it easy to get a website up and running with very little knowledge.

    Don’t use one of those.

    I can’t stress that enough. Don’t learn a framework, learn code.

    From the beginning, I decided that I wasn’t going to use a site builder (like WordPress or Squarespace), because if it broke, I wouldn’t know how to fix it. When you learn how to build a website using a framework, you don’t really learn how to build a website. You learn that framework.

    It’s more of a challenge up front to learn the basics and write all your HTML and CSS from scratch with just a text editor, but you’ll be far better off in the long run. When you know the core concepts and can write code from scratch, then you can build anything and learn any framework you want.

    Create Something Real

    Places like Code Academy that guide you through building a site can be great for getting an overview, but the best way to learn is to create something you actually want to build that people can actually use.

    If it wasn’t for building a website for my bakery, I probably wouldn’t have stuck with it. The combination of determination and deadline goes a long way towards learning.

    Learn One Thing at a Time

    Your first site isn’t going to be a masterpiece. That’s OK. If your first website works well to you on your computer, then that’s amazing. It’s a big achievement, and you should be proud of it.

    Every site you build will be a little better than the one before it.

    For your next site, maybe you’ll make it look great on your computer and a tablet. Then, make it look great on a smartphone. Then, make it load faster. There’s no perfect website. The important thing is to keep learning and improving.

    Get Stuck

    Every developer has lost countless hours of their lives staring a line of code that should work but doesn’t. A forgotten semicolon, a typo, extra whitespace. Anything.

    I would get so stuck that I wouldn’t even know where to start. I didn’t even know what words to use to describe the problem.

    It’s going to happen to you. And it’s going to keep happening to you. Everyday. Getting stuck is a great opportunity. On your quest for the answer, you’ll learn five new things before you finally figure out the solution.

    No One Knows It All

    It’s easy to get discouraged. There’s so much to learn, and so many smart people that will seemingly always know more than you. But that’s a great thing.

    We all know what it’s like to be overwhelmed and stuck. There are great communities of developers helping each other out, like on Stack Overflow. If you show that you’re doing your best to figure out a problem, but you’re stuck and have questions, people will gladly help.

    There’s No One “Right” Way

    People learn in different ways, but these tips are how I became a web designer and developer.

    Not only do we all learn and take different paths, but every coding problem can be solved in hundreds of ways. There’s no one right way. If you give ten developers the same site to build, you’ll end up with ten different solutions to the same problem.

    Just because you don’t code something perfectly the first time, remember, there is no perfect way. If it’s working, then it’s working. Be proud of that. You’ll keep improving and learning, and before you know it, you’ll be writing an article on how to get started as a web developer.

  • Let’s Celebrate! All Responsive Websites Look the Same

    The dust has settled from the introduction of Responsive Web Design (RWD), and we’ve honed design patterns that adapt well across devices. This has led to those same design patterns appearing on site, after site, after site. But few people seem to be celebrating this trend. Does it mean we’ve lost our desire to innovate, or is it that web design reaching a new level of maturity?

    Before I dive into why you should be happy about the lack of innovation in web design patterns and what needs to come next, let’s talk about zippers.

    Consider the Zipper

    The first zipper was invented in 1851 by Elias Howe, but things in zipper-dom didn’t pick-up until the modern day version of the zipper was created in 1913. That’s over 100 years ago. It worked then, and it’s still working now.

    Well… mostly. I’m looking at you, fly on my maroon pants.

    Innovation is driven by need. We haven’t needed a new version of the zipper, because the current one is good enough that no one has bothered to redesign or innovate it.

    A New Era of Zippers

    The zippers we all know can only zip in one direction. They can go around corners, like on suitcases, but that’s about the end of its adaptability. If you try to curve it laterally, it’ll just lock up in a column.

    Wendy Howard wanted to be able to use a zipper on a three-dimensional garment or object, so she invented a zipper that can go around curves.

    Source: http://www.pdesigni.com/features/show/8454

    The design of the old zipper wasn’t good enough for Wendy. Her need for a curving, adaptable zipper was a great enough need for her, so she innovated a new one called the ZipZag.

    The ZipZag looks like a normal zipper. It works like a normal zipper. But it can do so much more. Each zip on the tape can move independently, allowing for flexibility and suppleness even on curves and three-dimensional objects.

    It’s like the zippers of yore, but infinitely more adaptable (or, dare I say, responsive?) to different situations.

    “Good Enough” Web Design

    “Good Enough” is where we’re at with web design. Most sites don’t have that need for innovation, as the common patterns we’re seeing over and over are accomplishing their goals reasonably well under ideal circumstances.

    In Maciej Cegłowski’s, “Web Design: The First 100 Years,” he argues that we’re reaching a point of “good enough” in web design. People are moving away from super fast laptops towards slower mobile devices for the convenience, not performance. It’s not that we can’t innovate, but the need to isn’t as great. As for building websites, there’s really only one noble goal: to “connect knowledge, people, and cats.”

    “The web we have right now is beautiful. It shatters the tyranny of distance. It opens the libraries of the world to you. It gives you a way to bear witness to people half a world away, in your own words. It is full of cats. We built it by accident, yet already we’re taking it for granted.”
    – Maciej Cegłowski. Web Design: The First 100 Years

    Responsive Design meets that challenge head-on, and the common design patterns we’re using are delivering that content reasonably well to users on whatever device they’re using.

    It’s Not About Your Design

    If you agree that our goal as web developers and designers is to “connect knowledge, people, and cats,” then our designs aren’t the focus. People don’t go online to look at all the new web designs being launched. People go online for content.

    So, why do we hear a far-off, sad-trumpet playing when we see the same design patterns over and over? Do you hear that sad-trumpet when you get to the footer of a site?

    “Oh, LAME, they’re using a footer on their site? Those are so overused,” said no one, ever.

    The design patterns aren’t to blame (usually). It’s the content.

    For example, Font Awesome was an essential part of web design progress that allowed a huge icon set to be quickly integrated into any site’s content.

    Now Font Awesome is extremely overused, which was how it was set-up to be. That’s not the problem. The problem is that it’s used so often by content creators and designers that didn’t care to create genuinely useful content.

    When content is disingenuous, we feel like the website creators are wasting our time. Font Awesome icons have been generalized to the point of meaninglessness, or, worse – to the point that when we see them, we assume the content and product is generic and not worth our time. It’s not Font Awesome’s fault. It’s ours.

    The same goes for when we try to read “20 Amazingly Cute Cats That Will Explode Your Brain With Cuteness.” We click to it, get greeted by an ad, try to click to close it but the click registers to “like” it, then it loads the ad page, but we were just trying to close it, so we try to go back, the ad loads again and we sit through it this time, then the article finally loads and it’s a picture on each page instead of one page of all the images, etc.

    That site’s goal isn’t to “connect knowledge, people, and cats.” It’s to generate ad-revenue at the expense of its unfortunate users.

    To combat everything unnecessary that gets in the way of the content, Brad Frost released Death to Bullshit. Here’s how to create a great website, according to his death-to-bullshit-i-festo:

    Respect people and their time.
    Respect your craft.
    Be sincere.
    Create genuinely useful things.

    Brad Frost. Death to Bullshit

    We don’t need more innovation in web design’s visual styles, we need more genuine content. Because if you’re accomplishing the goals of your client and user, it doesn’t matter if you innovated design styles or not.

    It’s Still About Your Design

    I’m not trying to throwing content creators under the bus here. Web designers are still to blame when we intentionally create awful processes at the expense of our users. We need to stand back and let the content shine, not make our site styles the focus.

    Back in the old days of web design, we constantly pushed boundaries to see how unique our site could look, to push the limits of the medium. We’re maturing now where we’ve seen what works well and what doesn’t work. It’s a giant collective iteration.

    We’ve also realized the benefits of sharing design patterns across websites. You click the hamburger icon, and a menu shows up. This is a good thing. Users don’t need to learn a new icon for every site. Reuse of these conventions is helping people use sites more effectively.

    When your design lets the content be the focus, your design succeeds. It’s about the content. If the site is about the design, then reconsider your focus.

    What’s Left to Innovate with Web Design?

    So far, I’ve said our common design patterns are “good enough.”

    I lied.

    They’re “good enough” for a limited section of our users. Specifically, for sighted users on modern devices with fast connections. For everyone else, they’re awful.

    A full-background, parallax image might be worth the 1mb to you while you’re sitting at your desktop, but to someone on a terrible connection with an old device, that 1mb is worse than worthless. It’s preventing them from getting the content they wanted.

    We have to change what we think of as a solid design pattern. It can’t just be visually responsive across devices, it has to be accessible across devices for all users.

    The future of web design is not going to be shinier, more glamorous, win you web awwwards, or get you likes on dribbble. We have to innovate for our users that have been neglected by the designs that dominate the current state of the web.

    This is too important to not repeat it: Innovation in web design will make content more accessible.

    And people are innovating. Srcset and sizes is allowing browsers to pick the appropriate sized image to download based on device, critical CSS is bringing faster perceived load times, and ARIA attributes are allowing inaccessible designs and zippy javascript frameworks like Angular and React become accessible.

    All of these innovations and more are making content more accessible.

    Onwards

    It’s not going to be easy, but the alternative is that our websites are only built to serve sighted users on modern devices with fast internet connections. That doesn’t sound very accessible, inclusive, noble, or morally right to me.

    Let’s not forget though, that websites in their pure form are accessible. It’s mostly our designs getting in the way of our content, then us innovating to implement inaccessible, slow websites in an accessible way. We can’t let our “innovation” take us backwards.

    In the eloquent words of This is a Mother Fucking Website:

    “…you have no fucking idea what a website is. All you have ever seen are shitty skeuomorphic bastardizations of what should be text communicating a fucking message.”

    Let’s innovate universal access to content, not design trends. The simpler and more accessible our design patterns become, the better we’ll be able to communicate the fucking message.

  • Quick Tips to Improve your Website’s Accessibility

    Quick Tips to Improve your Website’s Accessibility

    Web accessibility shouldn’t be an afterthought, but, oftentimes, it is. Fortunately, for most basic sites, it’s easy to make some minor adjustments that make a huge difference in the site’s accessibility. I recently retrofitted some of my designs and code to be more accessible, so here’s a few quick tips I picked up along the way.

    Be Descriptive with Your Links

    Imagine what your link text sounds like out of context. “Click here” doesn’t tell us where we’re going. “Dessert Recipes” or “Chillin’ Beluga Whale” do, however. If you click, “Chillin’ Beluga Whale,” you have a pretty good idea of what you’re in for.

    All the people who clicked the Chillin’ Beluga Whale link just got a huge dose of plump, alien-looking beluga whales who just want to reelaaaaaaax, man.

    Check Your Design’s Color Contrast

    Shoot for at least a contrast ratio of 4.5 to make sure people can easily read your content. Use this contrast ratio tool to test your color combinations.

    For example, I just checked my link contrast for the first time, and it’s only 2.2. I need to change the color, even though I spent waaaaay too long picking out the one I felt was best for the design. Poor me…

    Give All Form Fields a Label

    Since getting into web accessibility, I’ll turn on my screen reader and test sites when I’m ordering something. It’s amazing how difficult to use some of them are. For example, if a site only uses placeholder text to communicate a text input, the screen reader reads to me “Edit text, blank.”

    That’s it. “Edit text, blank.”

    So, if I was trying to fill out this form without seeing it, all I’d know is that I can edit text, and that the field is currently blank. Not very helpful as to what I should actually type.

    Here’s a better way to do it:

    <label for="email">Email</label>
    <input id="email" name="email-address" type="text">
    

    Or, you can wrap the label, but make sure to still use the ‘for’ and ‘id’, as not all screen readers handle it right without it.

    <label for="email">Email
        <input id="email" name="email-address" type="text">
    </label>
    

    Make sure the label for=”” and input id=”” names match. That tells screen readers that this label is for that input. Now, when a screen reader announces that input, it’ll say, “Email. Email, edit text.”

    Much better.

    Don’t Use maximum-scale=1 in your Viewport Meta Tag

    Ever been to a site on an iPhone where you wanted to pinch-to-zoom to see an image larger, but it didn’t work? It’s probably because maximum-scale=1 was used.

    maximum-scale=1 removes the ability for users to zoom in on the page. Start zooming on a few random pages on your smart phone. It’s unfortunate how prevalent this issue is.

    A better way to do it is to set the initial-scale, then let your user decide if they want to zoom or not. This is the meta viewport code I use on my sites.

    <meta name="viewport" content="width=device-width, initial-scale=1">
    

    This issue highlights a good rule of thumb: Don’t remove features that are meant to improve accessibility.

    Don’t Remove Focus Outlines on Links

    I’m guilty of this. On most of my early sites, I wanted to remove those “ugly” outlines that appeared after you clicked an internal link.

    “I don’t use a keyboard to navigate the screen, so my users don’t use keyboards either!” I thought.

    For those who don’t, having a slight outline to show tab focus doesn’t make them fly into a rage and smash their fists on their computer. For those who do use a keyboard to navigate, removing the focus makes the website significantly less usable.

    The pros/cons of this are pretty clear. Remember, don’t remove features that are meant to improve accessibility.

    Don’t Open Links in New Tabs

    SEO, keywords, link juice, umm… mumbo jumbo…?

    It may come as a shock to you, but, I’m not an SEO person. So, I don’t know the implications of not using target=”_blank” to open external links in a new tab. But, I do know that when you use a screen reader and you click on a target=”_blank” link, it’s really vague that you just opened a new tab. It’s really easy for it to slip by you, or not be announced, so you don’t KNOW you’re on a new tab.

    Here’s the process, as I imagine it:

    1. Click link.
    2. Link opens in new tab, but you don’t know you’re on a new tab.
    3. You read for a minute on the new tab.
    4. All done. Time to go back to the previous page.
    5. *Do keyboard shortcut for going back in the browser*
    6. *Computer doesn’t do anything, because… there is no going back.
    7. *Reflect on the heaviness of this deeply meta situation*
    8. *Eventually, hopefully, realize you’re on a new tab and use the tabs to navigate to where you were*
    9. *Say a short-but-sweet curse upon people who code links to open in new tabs*

    So, yeah, don’t do that to people. Unless you like being cursed.

    Full disclosure – I still do this from time to time. If anyone who extensively uses a screen reader reads this article, can you do me a favor and let me know your opinion on this?

    Use ARIA Landmark Roles

    ARIA roles give a little extra info to screen readers. Some people say you only need to use them when the HTML5 semantics don’t already communicate it.

    For example, those people argue that if you’re marking up your navigation with <nav>, then you don’t need to do <nav role="navigation"> because you already communicated that the element is a navigation with the HTML5 semantics.

    However, the semantics only go as far as the screen reader program wants to follow those semantics.

    “But,” you say, “they should follow the rules! I don’t want to write extra code when they should follow the rules!”

    “Now, gentle reader,” I soothe, “let me tell you a little story about Internet Explorer.”

    Let’s actually not do that. But, overall, it’s a minor inconvenience to communicate the information twice and hope all screen readers follow whichever semantics they do use correctly.

    Here’s an example of how to markup most websites with ARIA roles:

    <header role="banner">
    
      <nav role="navigation">
        <!-- your navigation -->
      </nav>
    
      <form role="search">
        <label for="search">Search</label>
        <input type="search" id="search" name="search">
        <input type="submit" value="Search">
      </form>
    
    </header>
    
    <main role="main">
      <!-- show 'em that sweet, sweet content -->
    </main>
    
    <aside role="complementary">
      <!-- Hey! I want you to see this stuff, but this isn't why you're here. -->
    </aside>
    
    <footer role="contentinfo">
      <!-- I'm the footer, where the copyright, contact info, and whatever else you want to jam down here goes -->
    </footer>
    

    Pretty painless stuff.

    Add Extra Screen Reader Content to Give Context

    Our visual designs often use space to give meaning and relationships between items. A screen reader can’t interpret our intentions, just what’s in the content. So, read through your site and ignore the visual layout (ideally, read through the source code). Does it make sense without those icons? If not, add some content, but visually hide it so it doesn’t clutter up your design.

    To visually hide content but still let screen readers read it, add this to your CSS file:

    /* Text meant only for screen readers */
    .screen-reader-text {
        clip: rect(0 0 0 0);
        overflow: hidden;
        position: absolute;
        height: 1px;
        width: 1px;
    }
    
    .screen-reader-text:hover,
    .screen-reader-text:active,
    .screen-reader-text:focus {
        background-color: #f1f1f1;
        border-radius: 3px;
        box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
        clip: auto !important;
        color: #21759b;
        display: block;
        font-size: 1em;
        font-weight: bold;
        height: auto;
        left: 5px;
        line-height: normal;
        padding: 1em 1.6em;
        text-decoration: none;
        top: 5px;
        width: auto;
        z-index: 100000;
    }
    /* This code is taken from the Underscores WordPress theme and then adjusted from code from... I can't remember. Can anyone help me here? */
    

    Then, whenever you want to add content for screen readers to give context but hide it visually, just add the “screen-reader-text” class to your element and you’re done!

    <h3 class="screen-reader-text">Connect with Me on Social Media</h3>
    
    <ul class="social-icons">
        <!-- social media icons here -->
    </ul>
    

    Hide Unnecessary/Repeated Content from Screen Readers

    In the same boat as hiding content visually but showing it to screen readers, sometimes we need to hide content from screen readers that’s really helpful in our visual designs.

    For example, I like giant images, icons, and pull-quotes (repeated content) as much as the next designer, but, when using a screen reader, it doesn’t add to the content. Fortunately, it’s really easy to hide it from screen readers. Just add this code to any element you want to hide.

    role="presentation" aria-hidden="true"
    

    Here’s the markup I use for my social media icons in my footer. First, I use the screen-reader-text class (example earlier in the article) to hide “Connect with Jeremy Jones” because the context of the social icons suggest that to users who can see it, then I hide the social media icons from screen readers and offer them the social media site name instead. Here’s the code:

    <h3 class="screen-reader-text">Connect with Jeremy Jones</h3>
    <ul class="social-icons">
        <li class="twitter">
            <a href="https://twitter.com/juryjowns">
                <i role="presentation" aria-hidden="true" class="icon-twitter"></i>
                <div class="screen-reader-text">Twitter</div>
            </a>
        </li>
    </ul>
    

    I’ve also written a tutorial on creating accessible pull-quotes that uses this method.

    Use Skip to Content Links

    Using our “screen-reader-text” class above, we can now add a visually-hidden link that allows people on screen readers to skip over the header and go straight to the good stuff. Otherwise, when using a screen reader, you have to cycle through the whole header and navigation each time you go to a new page.

    Here’s how to do it:

    <a class="screen-reader-text" href="#main">Skip to content</a>
    
    <!-- logo & navigation -->
    
    <main id="main" tabindex="-1">
        <!-- sweet, sweet content -->
    </main>
    

    The tabindex=”-1″ and linking to the HTML5 main element is important, unfortunately, to fix a bug in Chrome.

    Test it With a Screen Reader

    If you’re on a Mac, fire up VoiceOver by pressing Command+F5.

    Control+Option are called the VO keys. When interacting with VoiceOver, you pretty much always press Control+Option and another key, so VO = Control+Option. Here are the key things to use when testing a website with VoiceOver:

    • VO+Space = Click
    • VO+Right Arrow = Focus next item (basically like a tab)
    • VO+Left Arrow = Focus previous item (aren’t you glad you didn’t remove those focus outlines?)
    • VO+Shift+Down Arrow = Interact with area. For example, if you click a tab, you need to use this to get into the content of the page. Or, just use your cursor to click the logo or a navigation link to bring the focus onto the content if you get stuck mashing keys that don’t seem to do anything.
    • VO+U = Opens a “rotor” that lets you scan through headings, links, and some other stuff. Kind of like an automatically generated table of contents. Use the arrow keys to navigate through them. Definitely worth checking out.

    If you want to learn more, WebAIM has a guide on using VoiceOver.

    If you use semantic HTML, you should be happy to find that 95% of your site works just fine. If you don’t use semantic HTML, well… you’ll see.

    For New Projects, Design Content-First

    This tip isn’t a quick tip for retrofitting an accessible site, but if you care about accessible sites, then I can’t stress this enough. If you design by creating your content first, then code your HTML before doing any visual design, your site is going to be more accessible without even trying. Well-coded, semantic HTML is accessible out of the box.

    Learn More

    It’s hard, if not impossible, to make a perfectly accessible website for 100% of users, but that doesn’t mean we shouldn’t try. You can learn a lot more tips and info on web accessibility by checking out the Accessibility Project.

    Are there any great tips that I missed? Do you think I’m giving bad advice? I’m not looking to be right, I’m looking to provide a really useful article to help people easily make their websites more accessible. Let me know in the comments or on twitter if there’s something I can do to improve it.

  • Skip to Content Link Bug in Chrome

    Skip to content links are a great way to give people using screen readers a quick way to skip your navigation and go straight to the good stuff. Unfortunately, Chrome’s implementation is buggy, and I tried to trouble-shoot it for far longer than I would have liked.

    My previous skip to content link looked like this:

    <a href="#content">Skip to content</a>
    
    <!-- logo & navigation -->
    
    <div id="content">
        <!-- content -->
    </div>
    

    My code problem: I don’t need a div just for content. I was just using it for styling, and I can probably get rid of it. However, this shouldn’t have stopped it from working. I had a javascript skip to content hack implemented that should have fixed it, but still didn’t.

    I came across a post by Greg Kraus at the NC State University Accessibility IT Blog called “Skip Links Shouldn’t Be This Hard“. The implementation he promoted was to simply add tabindex=”-1″ to the location.

    My code now looked like this:

    <a href="#content">Skip to content</a>
    
    <!-- logo & navigation -->
    
    <div id="content" tabindex="-1">
        <!-- content -->
    </div>
    

    I fired up OSX Voice Over and tested it out in Chrome. But, alas, it didn’t work. After clicking the skip to content link the focus skipped all the way down the page, past my content area. An improvement over staying in the same place in the header, but still not what I want my users to run into.

    The Solution for Skip To Content Links in Chrome

    I had another site I was working on that was linked to the HTML5 <main> element, and the skip to content link worked fine on that one, so I tried internally linking to the main instead of the unsemantic content div:

    <a href="#main">Skip to content</a>
    
    <!-- logo & navigation -->
    
    <main id="main" tabindex="-1">
        <!-- content -->
    </main>
    

    Huzzah! It worked! The tab focus jumped right to where I wanted it. Hopefully this will get fixed in future updates of Chrome, but it seems like it’s been around awhile. Fortunately, the fix doesn’t require any javascript.

    I haven’t tested it in any other screen readers besides OSX Voice Over. Leave a comment or contact me on twitter @juryjowns if you know a better, more reliable method.

  • WordPress Custom Themes vs Pre-made Themes: Which is Right for You?

    WordPress has great appeal because it’s a free, powerful content management system with thousands of pre-made themes to choose from. There’s so much you can do yourself using free or cheap pre-made themes, so when is it time to hire a developer/designer to do custom work for you? When is it better to save money and build it yourself?

    This article will evaluate the good, bad, and the ugly of custom made themes and pre-made themes so that you can decide which is best for you and your business. There’s a time and place for both, and I’ll do my best to give a level-headed, professional opinion on which is best in different scenarios.

    TL;DR: Custom vs Pre-Made Themes Flowchart

    I think you should read the whole article, but if you want the quick version, use this flowchart to help you make your decision. The rest of the article explains the reasoning behind this chart.

    [rsp_img id=”1684″ class=”theme-flow-chart”]

    Wordpress Custom Theme vs Premade Theme flow chart

    Custom WordPress Themes

    A good custom theme will always be better than the best pre-made theme. It’ll be more lightweight, load faster, and be more reliable. When building a site from scratch, you can tailor all design and code to accomplish your site’s goals.

    For example, a site’s goals could be:

    • People will know within 20 seconds what kind of business we are and who our clients are.
    • We want to build an email list of 1000 people who will become long-term customers within 6 months of launch.

    You don’t need to know your site goals ahead of time. A good designer/developer will help you figure out appropriate goals, and walk you through the process of how you can set, measure, and refine those goals.

    Who Should Use a Custom WordPress Theme?

    A custom site isn’t just about code and design, it’s about accomplishing goals. So, if you answer “yes” to any of these questions, you should seriously consider hiring someone to create a custom theme for you:

    • Is your website going to be your main source of revenue? If your website is heavily tied to your revenue, such as an ecommerce site, you should invest in your business and hire someone who can help you evaluate and implement the best set-up for you. Little details can make a huge impact on your site. Read The $300 Million Button to see what I mean.
    • Is your site going to have complex functionality or structure? For example, are you running a business with multiple locations that each have separate hours, directions, contact info, and employees? Are you starting a restaurant and want to have online ordering, online booking, and a menu that you can easily update daily specials, menu items, sections, and prices?
    • Will your website serve the role of a sales person or secretary? Automating tasks while connecting with customers is great, but it’s easy for these to be ineffective or difficult to manage. Hire someone who can design solutions that will work for you.
    • Will a great website give you a competitive advantage? Make it worth your customers’ time and yours by investing in a custom site. Websites aren’t checkboxes on the business list. If they’re not serving a purpose, it’s not worth the money.
    • Will your site have thousands of visitors per day? You’ll need to highly prioritize performance, or you’ll end up with a slowly loading site and lots of server crashes.

    Pros of Custom WordPress Themes

    • Tailored exactly to your needs.
    • Lightweight code.
    • More stable. Less moving parts means less variables that can break your site.
    • Site goals lead the design Rather than trying to retrofit a design to meet your goals.
    • Unique design. No site will look exactly like yours.
    • Future-proof. If coded well, you should be able to easily move to a new design in the future.
    • Experienced web designer. You get the expertise of the person designing and building your site to guide you through the process and help you avoid common, costly mistakes.
    • Saves time. You don’t have to build and design your site yourself.
    • Easier to manage complex tasks. For example, with the restaurant example above, a good developer can build a custom plugin that will allow you to easily enter your menu items, price them, rearrange them, etc.
    • Accessible for people with visual disabilities. Accessible sites are made by designer/developers who prioritize it. MANY websites are not friendly for screen reader programs. It’s not overly difficult to do, but oftentimes it’s not prioritized.

    Cons of Custom WordPress Themes

    • Expensive. For even the most basic site, plan to budget at least $2000 for an experienced designer and developer. This is not a hard and fast rule. Pricing is all over the place, so you may be able to find someone for cheaper. At the same time, don’t be surprised if an experienced designer/developer’s starting rate is $5000 or more.
    • Highly dependent on hiring the right person/firm. It’s hard to find someone with experience when there’s so much to understand when creating a website. How do you evaluate someone’s code when you don’t code? Make sure they’re honest and can point to specific goals they’ve accomplished for their clients. Test their sites on your phone, tablet, and desktop computer. See if they really work how they say they do.

    Pre-Made WordPress Themes

    Pre-made WordPress themes give a low barrier of entry to a website. It’s cheap, easy (sometimes), and allows you the satisfaction of building a website yourself. Before we go into the pros and cons of pre-made WordPress themes, it’s good to take a look at the main goals of companies and designer/developers who make WordPress themes:

    • Built for customization. When building a pre-made theme, the more adaptable it is, the more people you can sell it to. This means bloat. It’s like buying a toolbox when you only need the screwdriver.
    • Give tons of options. You’re not going to see any themes that promote themselves as “Totally Inflexible! Only One Font Choice and Color Palette! Limited Options!” But, in the end, you don’t need 400 fonts on your website, you only need one or two.

    This does not mean that pre-made themes are inherently bad. Pre-made themes serve a wonderful role by offering decent sites that can be set-up by people who don’t code. That’s a great thing. You just need to keep in mind what goals pre-made themes are trying to accomplish, and weigh the pros and cons to see if it fits your needs well.

    Who Should Use a Pre-Made WordPress Theme?

    A well-made custom WordPress theme is always going to be more lightweight and faster than a pre-made WordPress theme, and a Corvette is always going to be faster than a Prius. That doesn’t mean there isn’t a place for both. If you answer “yes” to these questions, a pre-made theme may be a better choice for you:

    • Do you have a budget of less than $2000? This is a rule of thumb. You can find people for cheaper because experience is varied.
    • Is your website just an informational “business card” site? If you won’t be making money off of your site or attracting a substantial amount of new customers from it, save your money.
    • Are your competitors’ sites poorly made? For example, if you’re a plumber, and all plumbers’ sites in your area are awful, then you probably don’t need much in order to be the cream of the crop in your market. Spend your marketing budget on a good Search Engine Optimization (SEO) person instead.
    • Is your site personal? If it’s just your personal blog, save your money and buy a pre-made theme that you like the design of and that works well.

    Pros of Pre-Made WordPress Themes

    • Cheap. Pre-made themes range from $0 to $150. High price does not necessarily mean quality though.
    • Lots of Options. You can easily select your own color palette and font choices.
    • You don’t need to know how to code. You might have to copy/paste complex shortcodes that are difficult to understand, but you don’t need to know any programming languages.
    • You can see the outcome. When you hire a custom designer/developer, you’re paying them before you actually see what they make for you. A good designer/developer will always make sure you’re happy with the outcome and explain why design decisions were made and what their impact is. With pre-made themes, what you see is what you get.
    • Satisfaction. It’s empowering to completely control your website and get it set-up on your own. If you’re someone who isn’t scared of learning new things and loves problem solving, you may have a great time learning the ins and outs of your WordPress site.

    Cons of Pre-Made WordPress Themes

    • Beware of switching themes in the future. Most of the time, pre-made themes heavily rely on shortcodes and custom fields. If you ever change themes, be prepared to start from scratch.
    • Difficult to set-up. Sure, you can display a page with a custom format, responsive grids, and a slider; but be prepared for a steep learning curve even if no code is involved.
    • Bloated. Offering tons of options goes hand-in-hand with bloat and sluggish sites.
    • Difficult to fix. As someone who makes websites for a living, anytime I’m hired to fix or add something to a pre-made theme, it takes me twice as long because pre-made themes are offering so many features and options. Every change you make, you have to check that you didn’t unintentionally break something else, and in pre-made themes, there’s a lot more to check.

    How to Evaluate Pre-Made WordPress Themes

    If a pre-made WordPress theme is right for you, how do you decide which one is best?

    • Test it. If it says it’s responsive, resize your browser and see how it handles it. Do things restack and reorganize well? Does the menu work well on an iPhone? If the theme demo site doesn’t work well, don’t expect your site to work well.
    • Run a speed test. Does it say it’s lightweight? Go to Pingdom’s Website Speed Test and enter the theme’s demo site URL. If the demo site has more than 40 http requests, it’s not lightweight. I tested a few pre-made themes, some of which said they were lightweight, and generally got anywhere from 80 – 130 requests. My website is run on WordPress, and the custom base theme I made only has 11 requests. Pre-made themes on the Genesis framework were by far the best, but I didn’t test that many.
    • Does it use scroll hijacking? Scroll hijacking is when you scroll the website, and the website changes your scroll speed, or doesn’t allow you to scroll how you normally do. I’m extremely biased against scroll hijacking for many reasons. When I see a theme that implements it by default without a specific, good reason, I skip it. There are so many themes out there, that a litmus test like this for quickly evaluating themes is helpful.

    What if Custom Themes and Pre-Made Themes Sound Right for You?

    If you answered “yes” to a lot of the questions on both the custom theme and pre-made theme sections, then hiring a consultant to install a pre-made theme might be right for you.

    For example, say you’re a small business who needs a website, and you have $800 budget to get everything built. You don’t have time to build it yourself, and you don’t have the budget or need for a custom website. A great option is hiring someone to implement a pre-made theme for you. The consultant you hire can help you decide on your site’s goals and pick a theme that will be best for your needs.

    There’s No 100% Right Answer

    Each business and site has different needs and goals. You might decide a custom theme is right for you, but you run across a pre-made theme that perfectly fits everything you need. Or, you may think a pre-made theme is right for you, and end up running into lots of problems. Lots can happen.

    Get the information you need to make the right decision, and do what’s best for you. Don’t feel bad or let people judge you for not making the “perfect” site.

    I’ve tried to be unbiased in this review, and I’m open to feedback. Think I’m wrong? Have more questions? Leave a comment and let me know.

    If you need to develop a custom theme, let’s get in touch.

  • Why Pixel Perfect Responsive Design is Wrong

    I’ve been reading over job postings for front-end developers and designers, and a lot them have a phrase like “You should love coding pixel perfect responsive designs”. Those jobs instantly go to my “no” pile.

    Responsive design means letting go of the idea of a pixel perfect design. Responsive designs need to adapt to any device thrown at them. You have to embrace the beauty of how malleable your design is. Let people access it how they want to access it.

    This doesn’t mean you should totally disregard mock-ups (unless you’re in with the cool kids who design in the browser). By all means, do a mock-up for each breakpoint, but don’t expect pixel perfect accuracy. A good responsive design emphasizes consistent ratios, and is coded with percentages and em values. Let your design stretch and shrink. Design for adaptability and accessibility.

    This is what makes design fun to me. Thinking about all the possible ways someone could access a website, and trying to provide a simple design and codebase that addresses all the project’s goals while being accessible to all users. That’s more relevant and exciting than holding “pixel perfect” as the goal.

    So, if you want to work with me (which, if you do, please get in touch), don’t put anything about being “pixel perfect” in your job description. That is, unless you create a breakpoint mock-up for every pixel from 50 to 5000. But, then again, if you do that, I still wouldn’t work for you.