When CSS Positioning Kills Functionality: Changing the Look of a WordPress Comments Form

When editing our theme, I had an interesting time editing the styling of the comments respond/reply form.

I was essentially modifying the WordPress TwentyEleven comments form, which looks like this:

WordPress TwentyEleven Comments Form

The form is huge though, especially since the blog posts we typically have are fairly short, I was afraid the comments form might end up bigger than the blog posts!

I figured the “quick” fix would be to simply lessen the amount of space between form fields. I did it the quick and dirty way, using:

#respond comment-form-field { margin-top: -30px }

Unfortunately, that broke the form fields. You could only activate the form field by clicking on particular areas of the field, which ended up being less than half of a field’s box.

It took me a while to figure out that the labels on each field would normally show above a field, but were repositioned on top of a form field. While this looks pretty, each label was taking up the equivalent space above a field; so if the whole field was repositioned to be closer to the above element, the space where the label would be overlaps the form field and thus block mouse behaviour. When a user tries to select the field, they’re actually selecting the paragraph element of the label:

Quick Fix Comments Form

In particular, this behaviour will happen any time an element overlaps another and its z-index is higher, literally positioned on top of the visible element below.

In the end, I restyled it with the labels above the fields so the gaps don’t look so big in between the fields. I also scaled it down somewhat, so that the end result is 243px shorter (in height) than the original and 123px shorter than even the ‘quick fix’ version. The end result:

Edited Comments Form

It still seems too large in comparison to a short post, so it will probably be restyled again later to be less wide as well and possibly scaled down even more. UPDATE: I wrote another blog post on further modifying the comments form, mostly using PHP.

Additional Information

For more on styling forms, check out WordPress’ article on Styling Theme Forms.

For those interested, here are the changes I made (classes that weren’t touched at all are not included):
[sourcecode language=”css” collapse=”true”]
#respond {
padding: 1.625em 0 1.625em 1.625em;
}
#respond input[type="text"],
#respond textarea {
(no change except removed text-indent)
}
#respond .comment-form-author,
#respond .comment-form-email,
#respond .comment-form-url,
#respond .comment-form-comment {
margin-top: -10px;
}
#respond .comment-form-author label,
#respond .comment-form-email label,
#respond .comment-form-url label,
#respond .comment-form-comment label {
-moz-border-radius: 3px;
border-radius: 3px;
left: -10px;
top: 4px;
padding: 3px 5px;
(mid-width removed)
}
#respond .comment-form-author .required,
#respond .comment-form-email .required {
font-size: 1.5em;
top: 33px;
}
/* added */
#respond .logged-in-as,
#respond .must-log-in,
#respond .comment-notes {
margin: 0.3em 0 1em;
 text-indent: 2em;
}
#respond .form-submit {
margin-top: -10px;
}
#respond input#submit {
font-size: 1.15em;
margin: 20px 0 0;
padding: 5px 15px;
left: 15px;
}
#reply-title {
font-size: 1.4em;
margin: 0;
(removed font-weight and line-height)
}
[/sourcecode]

ARLIS/NA 2012: Designing for Diversity

This morning, I attended the ARLIS/NA 2012 Conference workshop on designing for diversity presented/facilitated by the OCAD Inclusive Design Research Centre. There was a lot of discussion on barriers and challenges with some discussions on solutions. Honestly, I’m not sure I learnt anything new, but there were some interesting discussions that happened.

IDRC

Goal: digital inclusion

All their projects are open source, and include:

  • Engage: museum vistor experiences
  • CollectionSpace: collections management system, primarily by museum
  • Decapod: document digitization
  • Floe: inclusion in open education resources
  • Fluid: inclusive user experiences, umbrella project
  • Tecla via Komodo

User Experience Examples

We started with a discussion of general examples of good and bad user experience elements in our own personal experiences.

Bad

  • cord tangle
  • lack of browser interoperability
  • inconvenient touch keyboard layout
  • lack of flexibility in filling out forms e.g. 2 last names, accents
  • downtime
  • having to relearn interface of new version
  • can’t link direct to article
  • lack of search features
  • locked font sizes on email
  • meaningless error messages

Good

  • responsive design
  • transparency
  • alternative interactions i.e. touch
  • augmented reality layer
  • switch languages
  • filter searching
  • free wifi
  • autologin
  • RSS
  • cloud sync e.g. dropbox
  • social bookmarking
  • bibliographic managers
  • citation linking
  • security
  • consistency

Barriers

With respect to inclusion, what are some of the challenges or barriers at visual-based libraries/collections, image management, or other related products, services, organizations?

  • facilities concerns (i.e. older buildings)
  • alternative formats e.g. descriptions for image collections
  • cost/resources
  • expertise
  • attitude/awareness
  • vocabulary, translation
  • non-standardized vocabulary, but standardized doesn’t work as one size fits all
  • arranging physical collections to make sense
  • equipment/software inflexible

User Focus

Think about the user’s

  • goals
  • abilities and needs
  • expectations
  • pain points/frustrations
  • physical/environmental context
  • workflow context
  • current solution (if it exists)

User Modelling

While no linear or checklist, there are some important steps including working out scope (hunting and gathering of what are the possible problems), and behaviours (what happens when you interact, what want to achieve). Always a constant iterative work.

Personas

  • fictional, archetypal profiling of groups of users
  • humanizes abstract users

User states & contexts

  • enumeration of the various states and contexts users might be in
  • much more granular understanding of users
  • e.g. sensory, dexterity, cognitive, communication

One Solution Fits All

No one solution fits all, but if you’re restricted to one solution, then the key is to make a:

flexible, configurable environment.

Case Example

One of the situations we discussed is the physical reference desk. While the goal is for the desk to be a welcoming place where people know that’s where they can get help, the desk is frequently a place where there is a big standing only desk, which can be uncomfortable, tiring, and inaccessible.

Solution? Possibly, separate desks for different types of questions, with double monitors and possibly double keyboards for more in-depth or look up questions.

Do we need the desk? Particularly for directional questions, perhaps a desk isn’t even needed. For in-depth reference, the suggestion is to have two chairs on the same side of a table.

Media Access & Media Accessibility

Captioning is important to compensate to audio (poor, noisy background, not allowed), to quickly browse a video, catch details, show correct spelling, support for ESL, accessible, and it’s compliant. Description is important for similar reasons.

Captions and transcripts could greatly help with searching of media as well.

Few Media Players & Internet Plug-ins

  • Flash (DFXP, QTText)
  • Quicktime (QTText, SMIL, tx3g subtitles, CC tracks/Line 21 braodcast captions)
  • Windows Media Player
  • Silverlight
  • VLC
  • Flow Player – fallback to non-flash video
  • NCAM Player – find feature
  • JW Player – fallback to non-flash video
  • Magpie – Windows Captioning
  • Capcat (s?) -MAC Captioning

Information & Resources: Inclusivemedia.ca

Future Tools

  • HTML5 video with track tag once built into browsers

Stumped

I think the hardest part of moving the website into WordPress is recoding the site, not only for WordPress, but also into HTML5 and CSS3 standards, which involves making someone else’s code work and playing with a ColdFusion template as well. So, here’s my summary of the week represented by a KawaiiNot comic.

KawaiiNot Stumped

How Hard Can Finding a WordPress Carousel Plugin Be?

UPDATE: I posted a newer analysis in June 2012.

A lot harder than I thought, I can tell you that.

Requirements & Options

I did have a few requirements:

  • work in a sidebar
  • have manual image selection (i.e. not only through featured image on posts)
  • be able to set an external link for each image
  • some sort of navigation i.e. arrows or buttons
  • works with other necessary plugins for our site
  • 2D, not a fancy 3D one (though in the future a 3D one might be nice for special collections & archives)

Preferred options include:

  • buttons or numbers to skip directly to a specific image
  • left/right arrow navigation on hover
  • caption text at the bottom of image
  • variety of choices for animation
  • shortcode to easily add into widget

Results

I tested a lot of plugins (at least a dozen), many of which didn’t work. My guess is that many are dependent on its own version of jQuery and other js files that conflicted with the built-in WordPress one or incompatible with the newest WordPress in some other way.

  • JJ NextGen JQuery Slider looked promising, but because NextGen messes with user permissions, it was conflicting with the user management plugin I had installed. I’m wondering now if I disable that part of the plugin whether it will work.
  • DOP Slider works but isn’t ideal since there’s no captioning and the arrows weren’t showing up for me.
  • WP jQuery Text and Image Slider works but is also not ideal since it has no captioning and would need styling done so it doesn’t put it into a frame.
  • Nivo Slider for WordPress worked great. It would need a shortcode added (but that’s easy enough) and the buttons aren’t showing, which is obviously a bug, but we could probably fix it if we wanted them.

Many of the plugins are based on the jQuery Nivo Slider, which is free. Why not just use that? Well, we want our users to be able to add images themselves, and not rely on our team. The Nivo Slider developers offer a WordPress version, but it’s paid. It’s a fairly small amount though so I might recommend purchasing it instead of having to customize existing plugins, especially if it’s a one-time payment.

Sometimes it’s the Browser, not your Code

As a beginner coder, I generally assume that if something goes wrong it’s my code. While it’s true that a website needs to be coded in such a way that it’s interoperable, sometimes the problem originates in the browser. This may seem obvious to any web programmer, but it wasn’t to me, mostly because the assumption really is, “I’m not an expert, so the mistake must be something in my code.”

Font-size Chrome Bug

In my case, I was having issues with font sizes, and this is such a basic part of CSS that it never occurred to me that it was a browser issue. Lo and behold, it turns out the current version of Chrome (17.0.963.79) rounds font-sizes to the nearest whole number, and I was doing calculations based on Chrome. Because of this bug, the site I was formatting looked very different.

For example, say I have:
h2 { font-size: 1.2em; }
h3 { font-size: 1.17em; }

Firefox: h2 = 19.2px , h3 = 18.7167px
IE9: h2 = 19.2px, h3 = 18.68(?)px
but Chrome: h2 and h3 = 19px

See jsFiddle example.

While these differences are so small you can barely tell in the example, you can imagine that on an entire website, it has a pretty big effect especially if it’s a base font size. In the end, I filed a Chrome bug report and it’s being looked at.

Sometimes it’s a Mystery

In our website’s book banner, there is a little styling trick in order to make it look nicer. What really got me was that it was using absolute positioning (which generally I avoid). However, if you make it relative, it no longer does what it’s supposed to.

Have something like this in the CSS:
span {
position: absolute;
top: 1em;
left: 1em;
border: 10px solid transparent;
border-right: 10px solid blue;
}
span+span {
position: relative;
left: 2em;
}
the HTML should then have an empty block: <span></span><span></span>

Result: results in one arrow and one trapezoid
If you want to play with it, it’s on jsfiddle

So far, I haven’t found an answer, so I’ve simply recoded it to make it work in the new layout. Now the strange thing is that it works on MAC, but breaks using the same browsers on Windows.