hyperspace

O God, I could be bounded in a nutshell and count
myself a king of infinite space, were it not that I
have bad dreams.
Hamlet

We live in space. We move in space. Let’s accept that media—or at least virtual media—have no excuse for doing any less. Well, sure, they have plenty of excuses. But let’s accept that projections are just a temporary step.

Virtual reality is the future, and has been since the dawn of virtualization. Everything in between is just a compromise. Yes, the state of technology may compel us to think in little boxes (or cages), but reaching that future will not be entering new territory, but returning home.

God knows that undifferentiated space is no good. We will need some organizing function for the space at large. Our objective in this document is to formalize that organization.

Let’s think about space in terms of our “ideal first” design philosophy. Particularly if we assume that virtual reality is in our future, a natural starting point is to ask: how would we design X in a virtual space?

Contrast that with the opposite practice, where little screens are the starting point.

Here’s an analogy. At some point, basic computing resources became so cheap and abundant that programmers—or at least, application programmers—began to take for granted that memory and disk space were, for their purposes, infinite. If that wasn’t quite true yet, time was on their side; having gone from kilobytes to megabytes to gigabytes to terabytes in just a few years, the industry generally bet on the assumption that commodity hardware would eventually—nay, soon—catch up with the most careless extravagances. Obviously, there’s a real downside to this attitude: programmers raised in this period have less appreciation for efficiency than the older generation, which might decry that the art of byte-counting is lost forever. But there’s also an upside. Today’s programmer’s are free to think of things that would have been very hard to consider twenty-five or fifty years ago. Yeah, yeah, those limits didn’t stop visionaries from being way ahead of their time in all periods. But I’m talking about ordinary people with ordinary tools. Alan Kay himself—one of those visionaries—said that the right perspective is worth 80 points of IQ. Being born in this time, we’re given the perspective that immense computing power is available, and we can focus our intelligence on using it, rather than inventing it.

So it is with space. Just as a programmer looking at some “old” code might think with pity, how awful! what incredible effort was lavished on making this system run on the machines of the day—so will designers of the VR generation look at our work and think, Those poor people spent so much time trying to figure out how to cram the world into those little boxes!

These little, flat representations are made to modify themselves in various “unnatural” ways in order to respond to different contexts. Of course, the beauty of virtual spaces is that materials aren’t limited to realistic physical properties: they can stretch, bend, disappear, pass through one another, and so on. But because physical things don’t actually behave this way, you’re always paying some cognitive cost when you use them, both for yourself and for the user. Designers keep choosing to pay this cost, so there must be a good reason. The reward is that it helps you overcome the constraints of the platform. But I would argue that this is often the result of “bottom-up” reasoning, that is, reasoning that starts with the capabilities and conventions of the platform and works from there. As a result, more “natural” approaches may not be considered at all. I would argue that an “ideal first” mode of thinking leads to better alternatives.

1 how we talk about web sites

This is about the web’s other identity crisis. Not between documents and appliations, but between documents and space. To use the two harmoniously, it’s necessary to have a view of what is essential about both.

We talk about web sites using metaphors. We have to. Because what are web sites, really? Software.

One thing that people don’t do much is talk about the web as a “web.”

In what way is the web like a web? Well, it’s a “set of interconnected nodes,” right? This is what computer scientists call a “graph,” and it’s a very common data structure.

But is the web really a set of interconnected nodes? Presumably that idea is how it got its name, but it’s worth noting that links in the web are one-way. I’ll talk more about that in another time and place.

This model emphasizes the interconnectedness of the web, and it is perhaps best understood in the context of a “graph,” the data structure that was undoubtedly in the mind of the computer scientists who named it.

Two properties of the web make it a web:

  1. Addressing
  2. Linking

This is the least interesting metaphor for our present purposes. In particular, the tendency to visualize the web as a graph where links are the edges obscures the fact that the web may exhibit other useful topologies, particularly when considering the spatial metaphor. We’ll come back to that.

1.1 the “space” metaphor

One of the common metaphors that we use for talking about web sites is a spatial model. In this model, a web site is a place (or domain) where visitors are afforded views of “what’s there.” By changing location (or address) you go to another part/1 of the /site. When you follow a link, you end up on a different path.2 If you don’t like what you see, you can go back, and when you change your mind, you can go forward again. Some sites provide a site map to assist in navigation.3

1.2 the “publication” metaphor

At the same time, we have another way of describing the web, which follows a publication model. The central metaphor in this view is the page. This view is notionally supported by the the fact that we can print pages 4.

This view is also consistent with the notion of HTML as a document format, and the “semantic” elements introduced in HTML5—article, section, aside—strengthen this connection.

We also hear about publishing content to the web, and popular products like FrontPage and WordPress subscribe to this view. Perhaps more significant is the impact of the web on the actual print media industry. If you have ever walked into a public library and gotten the sense that it’s become a computer center with some bookshelves attached, you’ve seen the encroachment of this metaphor upon reality.

1.2.1 further consideration of the “page” metaphor

The web page is the basic unit of delivery, and if users only know how to do one thing on the web, it is to view pages.

But where does the notion of a web “page” come from?

The HTTP 1.1 specification (RFC 2616) uses the term “resource” to refer generally to anything supported by the protocol, and as such sits “below” the level at which we would talk about pages.

2 constructs

Although we talk about the site as existing in a virtual “space,” it is not an arbitrary 3D model. You can’t just put any shape anywhere; likewise, you can’t just move in any direction. Why not?

2.1 motivation

2.1.1 structure aids understanding

For one thing, this is needlessly complicated. But wait, we just argued that space is inherently more intuitive! Yes, but the space has to be organized somehow. If anything is possible, then there are too many ways to look for something. By establishing certain constraints up front, we limit the search space to something much more tractable. Ideally, those constraints would be the natural consequence of the domain’s “natural” organization; or, since most subjects are naturally messy, some artificial topology will do. As long as the structure is meaningful, the very act of navigating the space can be instructive. This is the argument from the merits (as opposed to necessity): that even if you had completely immersive interaction, you’d still choose some limiting structure.

2.1.2 impacts of little screens

On a more practical level, though, we do not have completely immersive interaction. The devices that people use stand between them and virtual spaces. In particular, the use of flat screens for both output and input creates a gap between what we might like to do and what we can actually do right now.

limitations on output

This affects what we can give the user. Two major restrictions are obvious: the lack of depth, and the lack of scope.

flatland

Yes, screens are “two-dimensional."5 The good news is, we do have ways to mitigate flatness. When Tufte talks about “escape from flatland,” he’s not saying that we should all make pop-up books. He’s talking about what you do with the flat medium you have. You escape flatland with smart design decisions. While we cannot yet produce a hologram in the user’s field of view, we can make a projection of the space that communicates depth to the viewer—not arbitrary depth, but enough.

scope

Then there’s the matter of scope. Screens are very small, compared to our field of view. In the real world—especially in a new and interesting place—we look around. We study the place. Our focus moves around without a particular plan or direction, alighting on one thing and another intuitively. This is a way of learning. Sure, we can only focus on a small amount at one time. But at this stage, we’re not looking too closely at anything—we’re just trying to get an overview. And even when we do choose something to study more closely, we are still aware of our surroundings; they communicate with us continously. They remind us where we are, and even how we feel, to some extent.

limitations on input

This also impacts what we can get from the user. This is in some ways more severe than the constraints on what we can give. People are used to looking at flat projections of space, which after all includes most film and video. But when it comes to expressing a spatial intention onto a flat surface, what do we have? Presumably video gamers have some such conventions, but I, like most people, am not a video gamer.

2.2 documents

We talk about the importance of documents in the context of the web platform. (Documents are a first-class building block.) Documents will also impact how we think about space.

In this domain, most of the in-depth content is in the form of documents. All paths eventually lead to documents.

2.2.1 focus (depth of field)

There is a tension between space and documents. Documents (as we know them) are a close-up affair—you bring them towards you to look at them. Whereas in space, you tend to look at things at some distance. We can’t effectively be in both modes at once. Yes, a music director can follow a score while looking out over the players—but this is a professional trained in a specialized task; such exceptions prove the rule.

Thus, we will assume that you are either looking at a document or not—and that if you are, then it is your main focus. Just as in space, this does not mean that it blocks everything else from view.

2.2.2 HTML as a hybrid format

HTML is called a “document” format. But let’s not confuse “documents” for our purposes with the HTML that we use to deliver them. HTML is only a document format if you use it that way. Now it is used in many other ways, some of them very non-document-like. We intend to use it as a container for space, which as we’ve already observed, is not like a document.

That said, we’ll try to make good HTML documents, anyway. Not because of some notions about a “semantic web,” which we have yet to see, but because it has practical benefits. Screen readers, terminal browsers, and search engines are all essentially user agents without stylesheets.6, whose job is easier when your HTML document is not nonsense.

2.2.3 annotations

Some of this may end up belonging in the web platform, depending on how it unfolds.

Special consideration may be given to the annotation of documents. I’ll have much more to say about this. For the moment, we note that, while a document may itself be “standalone,” its scope for annotation (particularly from outside sources) is unbounded. This open-endedness may be expressed graphically, for example, by presenting annotations on a material that never comes fully into view—the edges of which, in other words, are never all seen at once.

2.3 the viewport

It’s tempting to say that the viewport is the window through which people look at our space. But that’s not the case. At most, we could say that the viewport is a flat projection of our space, clipped to a rectangle. To be even more reductionist, the viewport is the grid of pixels whose colors we control.

https://xkcd.com/722/

computer_problems.png

Somewhere in the web specifications, “viewport” is defined, but not much more usefully:

User agents for continuous media generally offer users a viewport (a window or other viewing area on the screen) through which users consult a document.7

Note that the html and body elements are completely different. The html element is always the same size as the viewport, while the body scales with the content.8

First, we define some general rules, meaning those that target element type, not class or id.

2.3.1 disable horizontal scrolling

We disable horizontal scrolling of the main viewport.

For one thing, it causes a problem with “vertically fit” elements, since 100vh does not take into account a horizontal scrollbar (at least in Gecko).

But mostly, we just don’t use horizontal scrolling, as a general matter.

html, body
	overflow-x hidden

But wait, what if something really does extend out of the viewport on on side or the other? Won’t that mean that it’s unreachable? Yes, and that’s probably what we want. We’ll use these areas—"stage left” and “stage right,” if you will—to stash things that need to be ready to appear at any time. Without that hidden rule, browsers will adjust the size of the viewport to include that content, meaning that you can pan over to it. It also screws up the width of everything, including fixed-position elements with full width.

This has to be done on both html and body, because browsers are not consistent about which element is considered responsible for scrolling overflow content.

This doesn’t mean that we can never use horizontal scrolling; but if we did so, it would be on a different scrolling container.

2.3.2 use the entire viewport

Use the entire viewport. This is space, not a document.

margin 0                        // beat user agent default

When you want to size something proportionally to the viewport, just use the vh unit. That’s what it’s for, and it’s well-supported. This would go without saying, except that one used to set body and html to 100% height in order to accomplish this. Those days are over; doing that causes problems now, which I won’t get into. Just don’t do it.

2.3.3 zoom control

I’d like to show a picture of this. I’m not finding anything on the commons, but I suppose I could easily enough take my own picture. It doesn’t look like it would be easy to get an uncopyrighted picture of iOS, anyway. A suitable test site may well be mit.shakespeare.edu, as it still doesn’t have a viewport tag.

The web spent its first fifteen or so years on decent-sized screens. When handheld web browsers came along, many web sites were based on the assumption that the screen was at least as wide as a sheet of paper. Such extravagant assumptions are not easy to un-make, and yet mobile vendors—all right, Apple—desperately wanted to show that you could view the “real” web on their little screens. Their solution was to show a shrunken version of what it would look like on a large screen, letting the user “pinch” to zoom to the portion of interest (assuming the user could discern some interest). They accomplished this by setting an initial scale factor between CSS pixels (those seen by your layout) and device pixels (those seen by the user).

As soon as people started designing web sites with small screens in mind, they wanted a way to turn off the browser’s uncharitable assumption. The solution was the viewport pragma, which is specified as a meta value. The initial-scale=1 setting tells the browser not to scale your web page. The chief impact of this is that text is a normal size, and to the extent that your layout is based on em’s or rem’s, everything will be cool.

head <append>
	<meta name="viewport" content="initial-scale=1" />
</append>

According to MDN, “This pragma is used by several mobile devices only."9

Note that we don’t disable user zooming, even though we could do so with this tag. Yes, you can make a royal mess of the page by zooming it—even moreso than by scaling the font (which you can’t disable). But trying to prevent these built-in features is generally user-hostile and incurs their hostility in return.10

I think these @viewport rules essentially duplicate what’s in the meta viewport pragma.11

@viewport
	width extend-to-zoom
	zoom 1.0

@-ms-viewport                // Not provided by autoprefixer
	width extend-to-zoom
	zoom 1.0

2.3.4 adaptation

This is an extremely minimal set of “intents” related to the great variety of screen sizes. It’s a tough problem which I haven’t given much thought because support for handheld screens (where this becomes an issue) is a relatively low priority for me.

narrow-screen(width = 50rem)
	@media screen and (max-width: width)
		{block}

wide-screen(width = 50rem)
	@media screen and (min-width: width)
		{block}

short-screen(height = 35rem)
	@media screen and (max-height: height)
		{block}

very-short-screen(height = 27rem)
	+short-screen(height: height)
		{block}

The same thing for adapting type size to the viewport. Should only be used for special cases. And maybe should be called scale_type.

@import typesetting                                     // for reading width

constrain-font(threshold, size)
	@media screen and (max-width threshold)
		font-size size

boost-font(threshold, size)
	@media screen and (min-width: threshold)
		font-size size
		{block}

3 layers

See layers.

4 material

Blah blah blah. Google’s “Material Design.” Yes, things have to be made out of material.

4.1 paper

Much of willshake’s content comes from “old books.” The primary source for the text of the plays, for instance, looks like this:

File:First_Folio,_Shakespeare_-_0003.jpg

The same goes for illustrations (such as those of Howard and Selous).

https://archive.org/stream/playsofwilliamsh02shak_0#page/n11/mode/2up

From this, willshake’s colors

In order to distinguish the

We use this “paper” color is used in several places to

The paper color here defined was obtained in the following manner:

  1. Opened the image File:First_Folio,_Shakespeare_-_0846.jpg in GIMP
  2. Using the “Color Picker” tool with a sample radius of 6, several samples were taken from the margin to the left of the decorative image, where none of the reverse-side text is visible through.
  3. Of the values obtained in this manner (#f5e8c5, #f4e4c0, #f2e5c2), I chose the darkest one.
// TODO: Move this to "colors"
$paperColor = #f2e5c2
// I took some more samples in the area where text /does/ bleed through, because
// the above is a bit too bright.
$paperColor = #efe3bf
$paperColor = #eee1be
$paperColor = #d7cdaf

5 navigation and wayfinding

Some of the concepts that we use right away will be useful throughout the site.

5.1 signs

But thou didst understand me by my signs
King John, 4.2

We’re talking about navigational signs here. In the “real world,” such signs (at best) merely communicate: they tell you where something is relative to where you are. It’s up to you to get there.

In hyperspace, signs serve a double purpose: communication and navigation. The sign itself can take you to the place it’s talking about. It’s worth stopping to think about how cool that is. It’s the fundamental innovation of the web, also known as “hyperlinking.”

For our purposes, links are signs by default. In other words, we think of links that occur within a surrounding text as the exception and not the rule. Since signs are not “content” as such, we generally use a reverse color scheme for them–"white” text on some sufficiently dark background. Generally, signs have an indicative background; that is, their background color indicates something about their nature (see “colors”). We define a standard sign text color as being slightly transluscent white, so that it blends a bit with the sign:

$signTextColor = rgba(white, .8)

sign-text-color()
	color white                     // fallback for no rgba, but really, who cares
	color $signTextColor

5.1.1 circles

I’ve started using circles more and more. For lack of a better place, I’m putting it here, since it’s hard to imagine making something circular and not a signifier.

circle(width)
	width width
	height width
	border-radius 50%

You can see that this is halfway reasonable in CSS—/if/ you’re able to specify a width. You can get away with that when the text is short.

5.1.2 links are signs by default

CSS was invented so that designers could remove the default underline from links. We also don’t want the user agent’s default color.

Just kidding. But seriously, why do we do this? Because space. Although we don’t see the space at large as a document, we do still see hyperlinking as a principal mode of travel. In space, links are more like signs: they are standalone affordances, and they don’t need underline or coloring to distinguish them from the surrounding text. In cases where we do want to use links in text, we’ll set the styles explicitly based on the situation.

Besides all that, we have a somewhat subversive view of hyperlinking, which we’ll discuss elsewhere. Anyway, we oppose default hyperlink styles on both grounds.

a
	text-decoration none
	color inherit

Browsers care about users, too. Typical defaults include some rules that are intended to enhance usability and accessibility. Sometimes we don’t want those defaults.

common-rules()
	a
		&
		&:focus
		&:active
			outline 0
			-webkit-tap-highlight-color rgba(0,0,0,0)

The :focus and :active rules above prevent reflows caused by the focus rectangle, which extends outside of the link and can thus invalidate neighboring elements. We should indicate focus in some other way, but that will have to be done per-element using a repaint-only property.

Libraries are the only way to use one Stylus file from another, and libraries cannot emit any rules. Putting those rules into a function allows the rules to be copied into different places as needed.

See also this regarding an IE equivalent, although God knows where (or why) I’d get a Windows mobile device to even test it on.

As for -webkit-tap-highlight-color, this just disables a default behavior on mobile browsers that gives users visual feedback when they touch links and such. Why would we disable this useful feedback? Because we take pains to provide the same kind of feedback, only in a way that we control. Note that that rule will (supposedly) not take effect unless the element also has at least a nominal touchstart handler. As it is, we use that handler as part of said alternative. See pointing.

Note also that the above is done into a separate file. This is because we can (and do) use the same rules on SVG objects.

The rule from Firefox’s ua.css uses the following selector:

*|*:-moz-any-link:-moz-focusring

5.1.3 PROPOSAL disable text selection in signs

Because you sometimes inadvertently select text, but never (and never conceivably) do so intentionally.

5.2 arrows

Many of our signs will be directional. Since we’re interested in creating a sense of space and movement, we’ll often use arrows to… you know, point at things.

Our arrows will be simple: just triangles pointing one of four directions.

This can be done in CSS through some trickery, but don’t think for a minute that this is a good solution. It’s idiotic that this is how we draw triangles.

arrow-base(size)
	width 0
	height 0
	border size solid transparent

arrow-pointing(direction, size = 1em, color = inherit)
	arrow-base(size)
	pos = ({up: top, down: bottom})[direction] or direction
	border-{opposite-position(pos)}-color color

arrow-before-pointing(direction, size = 1em, color = inherit)
	&:before
		content ''
		arrow-pointing(direction, size, color)
		{block}

arrow-after-pointing(direction, size = 1em, color = inherit)
	&:after
		content ''
		arrow-pointing(direction, size, color)
		{block}

5.3 exits

Exit pursued by a Bear

The Winter’s Tale, 3.3

Part of a having a pleasant experience is not being afraid. And for some reason, even though most virtual interactions are of no consequence whatsoever, it is nevertheless very common for people to panic when they find that they have lit up a device’s pixels in an unexpected way. This is akin to the “get me out of here” feeling that people sometimes have in physical spaces, except that it’s more of a “go back to the way you were.” As things stand, visitors cannot modify willshake in any way, so there is nothing of a lasting nature that one could possibly have to “undo.” Still, we want to make sure that people learn quickly how to explore the space freely, part of which freedom is a convenient retreat. An exit is a uniform way to get out of places. “Uniform” because it must be recognizable even in unfamiliar places.

For our purposes, an “exit” is akin to the “close” button that is familiar from graphical operating systems. Although they look different on different systems, most people are familiar with their various incarnations. There is some potential for confusion here, though, since, in those systems, “exit” can be a distinct operation from merely dismissing a window. Again, this distinction doesn’t exist for us, since visitors do not manipulate the state of the site, but simply travel through it. In other words, there’s no such thing as “leaving something open” elsewhere. We mean to import only the “dismiss” aspect.

Exits of the kind found in windowing systems are less common on traditional, document-oriented web sites, although they are increasingly seen on web applications. This is a consequence of the different models. What are the semantics of “exiting” a place on a web site? In principle, this is a very simple question: since web sites use an hierarchical path structure, “exit” simply means “go up"—go up the tree, one step closer to home. (This is sometimes called “hacking” the path because you “hack off” the last part, and it’s a very useful way to explore web sites even when (or especially when) they don’t provide the links for you.) In willshake (owing to getflow) this approach is built-in. Path hacking always works. So for us, an “exit” is simply a link to the parent path.

This is not always the same as the place where the you came from. That’s what the browser’s “back button” is for; in other words, that kind of “undo” is also built into the web itself. So traditional web sites, which are typically just a collection of pages without a rigorously complete hierarchy, can serve the panic response “for free.” The web, it turns out, was also “emotionally designed” in that respect.

Here we define some standard traits of exit links. Basically, it is a box with an ‘✕’.

@import signs
@import pointing
@import centering
.exit-link
	position relative           // support positioned pseudo-elements
	circle(1.2em)
	vertical-align middle
	display inline-block
	background inherit
	box-shadow 2px 2px 4px -2px rgba(white, .5)
	box-shadow 2px 2px .5em -.1em rgba(#222, .8)
	<<fake X>>
	+user_pointing_at()
		background-color #F33
		text-decoration none            // TODO you still get the underline on IE

A “fake” X is used so that it’s guaranteed to look the same all the time. Sure, the MULTIPLICATION X character (✕) would do the same trick. But exactly how that looks will depend on the font that’s used. And if it’s using a web font (which it is), then the font may not be downloaded yet, meaning that it will suddenly change when the font becomes available. Worst of all, it’s impossible to truly center because text is baseline-oriented.

Instead, a couple of crossed boxes do the trick.

&:before
&:after
	content ''
	position absolute
	top 50%
	left 50%
	width 70%
	height 7%
	background rgba(#FFE, .8)
	transform-origin center
&:before
	transform translate(-50%, -50%) rotate(45deg)
&:after
	transform translate(-50%, -50%) rotate(-45deg)

5.3.1 exit link text

Since the text of the link is provided (using the ::before pseudo-element), an exit link can be empty. Of course, stylesheet-generated content won’t be visible on non-stylesheet viewers. If you want to support exit links on non-stylesheet viewers, just wrap it in an element with class exit-link-text, and it will be hidden:

.exit-link-text
	display none

Not sure if this is a problem, but check out this table from Google Webmaster Tools under “links to your site”:

| How your data is linked   |
|---------------------------|
| x                         |
| listen                    |
| all's well that ends well |
| henry v                   |
| julius caesar             |
| More »                    |

The number one way that pages are linked is ‘x’. I guess Google is smart enough to distinguish that as a kind of noise, but I’m inclined on this basis to use descriptive text.

Note that we sometimes “pre-render” the exit link; that is, render its markup before it is applicable, and use styles to show and hide it. This can help make transition smoother by reducing the number of reflows needed. In such cases, it would be better not to use exit link text, since that would be confusing on non-stylesheet viewers.

5.3.2 “title bars”

Exit links are usually used in association with a title, with a structure something like this:

<h1>
  <a href="/some/place">this page's title</a>
  <a href="/some" class="exit-link">...</a>
</h1>

By making some assumptions about the situations in which exit links are used, we can increase their uniformity.

@import centering
has-exit-link()
	position relative    // support positioned children

	// Assume that the title text is contained in a single element.
	> :first-child
		padding-left 1em  // get past the exit link

	> .exit-link
		left -.25em
		vertically-center()
		margin-top -.25em

When used in conjunction with a title, the exit link should affect the centering and clipping (via text-overflow) of the title. In other words, the the title’s container should not overlap with the exit link. We’ve found that flexbox is the only way to accomplish this.

5.3.3 BUG exits are wrong in IE11

This is an old, though. Maybe it’s not the case anymore. I assume it was a flexbox thing, whatever I saw.

6 arrangement

6.1 docking

Like HTML, CSS is document-oriented by default. Unless you tell it otherwise, everything will be “flow positioned.” This is great for long-form text because you have no idea what its size will be. But when you’re spatially modeling, you tend to position things “absolutely.” A convenient technique is to position elements to fill their container. (I call this “hugging your parent”) Common variations on this include hugging all but one side of the parent.

hug-parent(top = 0, left = 0, right = 0, bottom = 0, position = absolute)
    position position
    top top
    left left
    right right
    bottom bottom

dock-top(top = 0, left = 0, right = 0, position = absolute)
    position position
    top top
    left left
    right right

dock-left(left = 0, top = 0, bottom = 0, position = absolute)
    position position
    top top
    left left
    bottom bottom

dock-right(right = 0, top = 0, bottom = 0, position = absolute)
    position position
    top top
    right right
    bottom bottom

dock-bottom(bottom= 0, left = 0, right = 0, position = absolute)
    position position
    left left
    right right
    bottom bottom

6.2 centering

CSS notoriously lacks intuitive support for common centering situations. We use Stylus to help us translate a readable intent into the thing required by CSS (where such is even possible).

centered-block(width = unspecified)
	margin 0 auto
	if width is not unspecified
		width width
		max-width 100%

positioned-centered-box(width)
	left 50%
	width width
	margin-left (width / -2)

full-center()
	position absolute
	top 50%
	left 50%
	transform translate(-50%, -50%)

horizontally-center(position = absolute)
	position position
	left 50%
	transform translateX(-50%)

vertically-center(position = absolute)
	position position
	top 50%
	transform translateY(-50%)

6.3 metrics

This may also belong better somewhere else

A “thumb” is a unit of measure that is used as a building block where the design calls for fixed sizes of some rough granularity. As this approximates the size of an actual thumb on a touchscreen (conservatively), we would prefer to keep affordances at least this size (although in practice, flow-positioned links are often smaller).

This metric is supposed to be available everywhere and shouldn’t be scaled by context, so we use rem’s. Since 16px is the effective default in all browsers, this gives us a 96px area (before any user font scaling).

But if you’re using this unit on something that does happen to have its font scaled (preferably up), and you still want to use some go-to metric, it’s convenient to have it expressed in em’s.

Bottom line, nothing touchable should ever be smaller than this.

7 dynamics

For lack of a better term. I’m just trying to balance out the tree here.

7.1 pointing

In space, we point at things. Usually, it’s a way of saying, “Look at that!” It can also be a way of answering a question: “Where is it?” “It’s over there!” Babies point at things to say, “Give me that!” Grown-ups generally consider this rude.

In our current “interactive” media, we don’t have much occasion to tell someone “Look at that!” or “It’s over there!” by way of our devices, so pointing gestures are relegated almost entirely to their “Give me that!” form.

7.1.1 mice and touch screens

As of this writing, we still have two main ways of pointing at virtual things: via mouse and touch screens. While touch screens are gradually replacing the mouse for gesture inputs, they will both be around for a while, and we need to make sure they both work as expected.

Although touch screens have been around for a long time, they were not mainstream until the “mobile revolution” of the mid 2010’s. Many people find touch screens much more natural to use, but for software designers raised in the mouse era, touch screens are a major curve ball.

Hands are capable of an infinite range of expressiveness.12 If the mouse reduced this infinite range to a thin trickle, touch screens reduced it significantly less so. Naturally, it took browser vendors a long time to agree on how exactly to model this “new” thing.13 In the meantime, browsers basically mapped touch events to whatever seemed like the closest mouse equivalents. This was a stopgap. The mouse pointer, for example, is always on the screen, whereas fingers can go onto the screen and come off again. And so on. Those differences are a problem for the people working on the web platform itself.

But for our part, we’d rather not think about it. When we’re making things that might get pointed to, we don’t care what the pointing method is. We only wish to express the intention that something change in a certain way when the user is pointing at it. If we can do that without reference to the mechanism, that’ll cover us most of the time. So we define a notion called user_pointing_at:

user_pointing_at(also = '')
	when = '&:hover, &.active, &.pointing'
	when += ',' + also if also
	{when}
		{block}

This allows us to treat the “hovered” state as equivalent to the “touched” state—more or less. A touch stops being considered a pointing gesture when it moves (while still on the screen), since this is generally interpreted as an intention to scroll. We cover this exception in the script below.

We also include :active here, meaning that links will retain the “pointing” style while they are being processed, even after the touch is over. This provides additional feedback that something is happening.

There’s a problem in mobile browsers where the :hover state doesn’t go away after it is activated on a link. Right now I don’t know a way to fix it.

Now, wherever we want to give feedback that a thing knows it’s being pointed to, simply use it like so:

#some-thing
	+user_pointing_at()
		background $special_color

(Note that block mixins must be prefixed with a plus sign.)

There’s some javascript code that goes with this. I don’t have an additive mechanism for that right now.

Generally this will be used for links (a.k.a. signs), which are the only thing in the space that responds to pointing. In fact, the following script assumes as much.

Now all we need to do is set the pointing class on links while they are being touched.

7.2 motion

This belongs in the context of a discussion about the problem that getflow is intended to solve.

The whole objective of the spatial design is to create a sense of space. So naturally the space needs to feel continuous, without things appearing and disappearing, or moving abruptly.

When you move from one part of the site to another, the internal structure is modified in a number of ways to carry out the transition. The hope is that it will appear natural and seamless to the viewer.

Frankly, we don’t have a science or philosophy of transitions. But we do define some defaults so that, at least when several elements are moving at the same time, they should complete at about the same time.

$defaultTransitionDuration = .33s
$defaultTransitionTiming = ease-out
//$defaultTransitionTiming = cubic-bezier(0,.75,.59,1)

default-transition(property = '')
	transition s(property) $defaultTransitionDuration $defaultTransitionTiming

$easeInOutQuart = cubic-bezier(0.770, 0.000, 0.175, 1.000)

8 accessibility / hypertext terminals (non-stylesheet support)

Need another word for this. “Terminal” has nothing to do with it. But it’s not just “plain text,” either. Maybe “hypertext” is what it’s really about.

With all that said about space, we do want to “support terminals,” that is, we do want the web site to be usable in plain text (or relatively plain-text) viewers. Such viewers will rely more heavily on the “semantics” of the document, without reference to the stylesheets whatsoever.

How does this affect anything? To some extent, just “doing the right thing” when writing markup will in itself yield usable results in terminal browsers. But sometimes the “semantic” choice of markup elements gives us default presentation that we almost never want. We choose that markup anyway, and then reverse the default presentation in the stylesheet. That way, we get what we want in both places.

8.1 plain lists

Lists are the most common case of this. By default, browsers present an unordered list (ul) kind of like this:

  • with a “bullet” for each item
  • with a gap on the left, to make room for the bullets
  • with a margin before and after, some breathing room for adjacent blocks

This all makes sense for a document (such as this one). But list semantics are also useful in space, where you’re positioning the items individually. In such cases you don’t want those defaults. Still, much of our content is in document form, and in those cases, we do want the defaults. So instead of applying this to all lists by default, we define a plain-list mixin that can be used as needed:

plain-list()
	list-style-type none
	padding-left 0
	margin 0

8.2 elements specifically for terminal

Finally, we may in some cases cater specifically to terminal viewers, when we can’t get the desired effect through other means. For example, there are cases where a line break makes the output much more readable in a terminal but has unwanted effects on the “graphical” (or “layout”) version. In such cases, we write the necessary markup and add the tty class:

@media screen
	.tty
		display none

Why this should apply only to screen media I couldn’t quite say right now.

At any rate, all stylesheets now target screen only by default.

Footnotes:

1

DEFINITION NOT FOUND.

2

DEFINITION NOT FOUND.

3

DEFINITION NOT FOUND.

4

DEFINITION NOT FOUND.

5

DEFINITION NOT FOUND.

6

Yes, Google takes the rendered page into consideration. But Google is not the only search engine, you know.

7

“The Viewport”, W3C, “Cascading Style Sheets, level 2, Visual formatting model” http://www.w3.org/TR/CSS2/visuren.html#viewport

8

The 2004 article “Understanding the HTML versus BODY Element in CSS” by Gavin Kistner illustrates the distinction.

10

See, for instance, this Hacker News discussion: https://news.ycombinator.com/item?id=9413992

11

The MDN docs are currently a little thin: https://developer.mozilla.org/en-US/docs/Web/CSS/@viewport

12

For an excellent reflection on this subject, see (as always) Bret Victor, “A Brief Rant on the Future of Interaction Design,” November 8, 2011. http://worrydream.com/ABriefRantOnTheFutureOfInteractionDesign/

13

To wit, they have still not quite agreed; see “touch events verus pointer events.”

For illustrations of how touch events are modeled, see “Handling Events” from Apple’s “Safari Web Content Guide,”

  1. https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html

about willshake

Project “willshake” is an ongoing effort to bring the beauty and pleasure of Shakespeare to new media.

Please report problems on the issue tracker. For anything else, public@gavinpc.com

Willshake is an experiment in literate programming—not because it’s about literature, but because the program is written for a human audience.

Following is a visualization of the system. Each circle represents a document that is responsible for some part of the system. You can open the documents by touching the circles.

Starting with the project philosophy as a foundation, the layers are built up (or down, as it were): the programming system, the platform, the framework, the features, and so on. Everything that you see in the site is put there by these documents—even this message.

Again, this is an experiment. The documents contain a lot of “thinking out loud” and a lot of old thinking. The goal is not to make it perfect, but to maintain a reflective process that supports its own evolution.

graph of the program

about

Shakespeare

An edition of the plays and poems of Shakespeare.

the works