{"id":37,"date":"2024-02-27T20:05:13","date_gmt":"2024-02-27T20:05:13","guid":{"rendered":"https:\/\/twobitranch.io\/?p=37"},"modified":"2026-09-14T13:35:59","modified_gmt":"2026-09-14T13:35:59","slug":"bruised-by-buttons","status":"publish","type":"post","link":"https:\/\/twobitranch.io\/index.php\/2024\/02\/27\/bruised-by-buttons\/","title":{"rendered":"Bruised by buttons"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\"><\/h1>\n\n\n\n<p>There are many dangerous professions in the world.<\/p>\n\n\n\n<p>Firefighter. Deep-sea diver. Bull rider. Professional cricket umpire.<\/p>\n\n\n\n<p>And then there is the front-end web developer.<\/p>\n\n\n\n<p>People assume we sit comfortably at a desk, drinking artisanal coffee while gently arranging rectangles on a screen.<\/p>\n\n\n\n<p>This is propaganda.<\/p>\n\n\n\n<p>The truth is that front-end development is a high-risk occupation involving unpredictable buttons, hostile CSS, emotionally unstable browsers, and the occasional JavaScript error that appears to have been personally sent by Satan.<\/p>\n\n\n\n<p>I know this because I have been bruised by buttons.<\/p>\n\n\n\n<p>Not metaphorically.<\/p>\n\n\n\n<p>A button.<\/p>\n\n\n\n<p>A small, innocent-looking rectangle.<\/p>\n\n\n\n<p>It had rounded corners.<\/p>\n\n\n\n<p>It was blue.<\/p>\n\n\n\n<p>It said <strong>Submit<\/strong>.<\/p>\n\n\n\n<p>And it ruined my Tuesday.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Button Looked Fine<\/h2>\n\n\n\n<p>The trouble began when the designer sent me a Figma file.<\/p>\n\n\n\n<p>\u201cShould be straightforward,\u201d they said.<\/p>\n\n\n\n<p>Whenever someone in software says \u201cshould be straightforward,\u201d prepare for structural damage.<\/p>\n\n\n\n<p>I opened the design.<\/p>\n\n\n\n<p>There it was.<\/p>\n\n\n\n<p>A button.<\/p>\n\n\n\n<p>Width: 142 pixels.<\/p>\n\n\n\n<p>Height: 44 pixels.<\/p>\n\n\n\n<p>Border radius: 8 pixels.<\/p>\n\n\n\n<p>Font weight: 600.<\/p>\n\n\n\n<p>Padding: 12px 20px.<\/p>\n\n\n\n<p>I thought, <em>I can do this.<\/em><\/p>\n\n\n\n<p>This was my first mistake.<\/p>\n\n\n\n<p>I wrote the CSS.<\/p>\n\n\n\n<p>The button looked perfect.<\/p>\n\n\n\n<p>Then I clicked it.<\/p>\n\n\n\n<p>Nothing happened.<\/p>\n\n\n\n<p>I clicked it again.<\/p>\n\n\n\n<p>Still nothing.<\/p>\n\n\n\n<p>I clicked it with increasing emotional intensity, as though the button might respond to disappointment.<\/p>\n\n\n\n<p>Nothing.<\/p>\n\n\n\n<p>Turns out the click handler was attached to a parent element that was being covered by an invisible div.<\/p>\n\n\n\n<p>The invisible div had no business being there.<\/p>\n\n\n\n<p>Nobody knew why it existed.<\/p>\n\n\n\n<p>Nobody dared delete it.<\/p>\n\n\n\n<p>It had been in the codebase since 2019.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Button Has States<\/h2>\n\n\n\n<p>A button is never merely a button.<\/p>\n\n\n\n<p>A button has <strong>states<\/strong>.<\/p>\n\n\n\n<p>There is:<\/p>\n\n\n\n<ul>\n<li>Default<\/li>\n\n\n\n<li>Hover<\/li>\n\n\n\n<li>Focus<\/li>\n\n\n\n<li>Active<\/li>\n\n\n\n<li>Disabled<\/li>\n\n\n\n<li>Loading<\/li>\n\n\n\n<li>Error<\/li>\n\n\n\n<li>Success<\/li>\n\n\n\n<li>\u201cPlease don&#8217;t click me twice\u201d<\/li>\n\n\n\n<li>\u201cThe API is thinking\u201d<\/li>\n\n\n\n<li>\u201cThe API has given up\u201d<\/li>\n\n\n\n<li>\u201cThe designer has changed the color\u201d<\/li>\n\n\n\n<li>\u201cInternet Explorer has interpreted the CSS spiritually\u201d<\/li>\n<\/ul>\n\n\n\n<p>The designer sends one button.<\/p>\n\n\n\n<p>The developer builds nine.<\/p>\n\n\n\n<p>The product manager asks why the button looks different on mobile.<\/p>\n\n\n\n<p>The developer quietly opens a window and stares outside.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Then Comes the Hover State<\/h2>\n\n\n\n<p>Hover is one of the greatest illusions in computing.<\/p>\n\n\n\n<p>The desktop user hovers over the button.<\/p>\n\n\n\n<p>The button changes color.<\/p>\n\n\n\n<p>Wonderful.<\/p>\n\n\n\n<p>Then someone tests the site on a phone.<\/p>\n\n\n\n<p>\u201cWhy doesn&#8217;t the button turn darker when I hover?\u201d<\/p>\n\n\n\n<p>Because, Brenda, <strong>there is no hover on your thumb.<\/strong><\/p>\n\n\n\n<p>This is apparently controversial.<\/p>\n\n\n\n<p>Now the developer has to explain that touchscreens do not have a tiny invisible mouse living beneath the glass.<\/p>\n\n\n\n<p>This meeting lasts 47 minutes.<\/p>\n\n\n\n<p>Someone suggests adding a hover animation anyway.<\/p>\n\n\n\n<p>The developer&#8217;s soul leaves their body.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">CSS Enters the Room<\/h2>\n\n\n\n<p>Eventually, someone says:<\/p>\n\n\n\n<p>\u201cCan we just make the button 10 pixels wider?\u201d<\/p>\n\n\n\n<p>Sure.<\/p>\n\n\n\n<p>Ten pixels.<\/p>\n\n\n\n<p>No problem.<\/p>\n\n\n\n<p>You change:<code>width: 142px;<\/code><\/p>\n\n\n\n<p>to:<code>width: 152px;<\/code><\/p>\n\n\n\n<p>And suddenly the navigation wraps.<\/p>\n\n\n\n<p>The footer moves down.<\/p>\n\n\n\n<p>The card becomes taller.<\/p>\n\n\n\n<p>The modal is now 17 pixels too wide.<\/p>\n\n\n\n<p>The mobile breakpoint activates.<\/p>\n\n\n\n<p>The hamburger menu develops a personality.<\/p>\n\n\n\n<p>You undo the change.<\/p>\n\n\n\n<p>Everything returns to normal.<\/p>\n\n\n\n<p>This is called <strong>CSS<\/strong>.<\/p>\n\n\n\n<p>Nobody understands it.<\/p>\n\n\n\n<p>We merely negotiate with it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Padding Incident<\/h2>\n\n\n\n<p>One afternoon, I was asked to vertically center the text inside a button.<\/p>\n\n\n\n<p>Simple.<\/p>\n\n\n\n<p>I tried <code>padding<\/code>.<\/p>\n\n\n\n<p>The button got taller.<\/p>\n\n\n\n<p>I tried <code>line-height<\/code>.<\/p>\n\n\n\n<p>The text moved approximately three pixels.<\/p>\n\n\n\n<p>I tried <code>align-items: center<\/code>.<\/p>\n\n\n\n<p>Nothing.<\/p>\n\n\n\n<p>I tried <code>display: flex<\/code>.<\/p>\n\n\n\n<p>The button immediately became perfect.<\/p>\n\n\n\n<p>I stared at the screen.<\/p>\n\n\n\n<p>The screen stared back.<\/p>\n\n\n\n<p>I had discovered the ancient front-end secret:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>If you don&#8217;t know what you&#8217;re doing, use Flexbox.<\/p>\n<\/blockquote>\n\n\n\n<p>It is the duct tape of the web.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Accessibility Strikes Back<\/h2>\n\n\n\n<p>Then comes accessibility.<\/p>\n\n\n\n<p>\u201cMake sure the button has a visible focus state.\u201d<\/p>\n\n\n\n<p>Absolutely.<\/p>\n\n\n\n<p>I add one.<\/p>\n\n\n\n<p>The designer sees it.<\/p>\n\n\n\n<p>\u201cWhat is that ugly blue outline?\u201d<\/p>\n\n\n\n<p>\u201cThat is keyboard focus.\u201d<\/p>\n\n\n\n<p>\u201cCan we remove it?\u201d<\/p>\n\n\n\n<p>\u201cNo.\u201d<\/p>\n\n\n\n<p>\u201cCan we make it invisible?\u201d<\/p>\n\n\n\n<p>\u201cThat would defeat the entire purpose.\u201d<\/p>\n\n\n\n<p>There is silence.<\/p>\n\n\n\n<p>The designer looks at me.<\/p>\n\n\n\n<p>I look at the button.<\/p>\n\n\n\n<p>The button looks at both of us.<\/p>\n\n\n\n<p>For once, we agree on something.<\/p>\n\n\n\n<p>The button has chosen violence.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Button Works on My Machine<\/h2>\n\n\n\n<p>Eventually, everything works.<\/p>\n\n\n\n<p>Chrome: perfect.<\/p>\n\n\n\n<p>Firefox: perfect.<\/p>\n\n\n\n<p>Safari: mostly perfect.<\/p>\n\n\n\n<p>Mobile Safari: the button has moved approximately 600 miles south.<\/p>\n\n\n\n<p>Android Chrome: acceptable.<\/p>\n\n\n\n<p>Old corporate laptop running a browser last updated during the Obama administration: catastrophic.<\/p>\n\n\n\n<p>Someone reports:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>\u201cButton broken.\u201d<\/p>\n<\/blockquote>\n\n\n\n<p>I ask:<\/p>\n\n\n\n<p>\u201cWhat browser?\u201d<\/p>\n\n\n\n<p>They reply:<\/p>\n\n\n\n<p>\u201cInternet.\u201d<\/p>\n\n\n\n<p>I close my laptop.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Production<\/h2>\n\n\n\n<p>The final test passes.<\/p>\n\n\n\n<p>The button works.<\/p>\n\n\n\n<p>The deployment succeeds.<\/p>\n\n\n\n<p>The website goes live.<\/p>\n\n\n\n<p>I lean back in my chair.<\/p>\n\n\n\n<p>For the first time in eight hours, I feel peace.<\/p>\n\n\n\n<p>Then Slack explodes.<\/p>\n\n\n\n<p><strong>URGENT: BUTTON IS BROKEN IN PRODUCTION.<\/strong><\/p>\n\n\n\n<p>I click the link.<\/p>\n\n\n\n<p>The button is fine.<\/p>\n\n\n\n<p>I refresh.<\/p>\n\n\n\n<p>Fine.<\/p>\n\n\n\n<p>Incognito.<\/p>\n\n\n\n<p>Fine.<\/p>\n\n\n\n<p>Different browser.<\/p>\n\n\n\n<p>Fine.<\/p>\n\n\n\n<p>I ask the person to refresh.<\/p>\n\n\n\n<p>They do.<\/p>\n\n\n\n<p>\u201cStill broken.\u201d<\/p>\n\n\n\n<p>I ask for a screenshot.<\/p>\n\n\n\n<p>They send one.<\/p>\n\n\n\n<p>The button is fine.<\/p>\n\n\n\n<p>I zoom in.<\/p>\n\n\n\n<p>They are clicking the label next to the button.<\/p>\n\n\n\n<p>Not the button.<\/p>\n\n\n\n<p>I explain this gently.<\/p>\n\n\n\n<p>They respond:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>\u201cOh.\u201d<\/p>\n<\/blockquote>\n\n\n\n<p>This is why front-end developers age like antique furniture.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Real Enemy<\/h2>\n\n\n\n<p>After years of front-end development, I have learned an important lesson.<\/p>\n\n\n\n<p>The enemy is not JavaScript.<\/p>\n\n\n\n<p>It is not CSS.<\/p>\n\n\n\n<p>It is not browsers.<\/p>\n\n\n\n<p>It is not even the designer.<\/p>\n\n\n\n<p>The enemy is the humble expectation that something should be <strong>easy<\/strong>.<\/p>\n\n\n\n<p>\u201cIt&#8217;s just a button.\u201d<\/p>\n\n\n\n<p>No.<\/p>\n\n\n\n<p>It is never just a button.<\/p>\n\n\n\n<p>It is a 14-layer archaeological dig through HTML, CSS, JavaScript, accessibility, responsive design, product requirements, design systems, browser compatibility, analytics, APIs, state management, and one mysterious <code>&lt;div&gt;<\/code> that nobody is allowed to remove.<\/p>\n\n\n\n<p>So if you see a front-end developer staring blankly at their monitor tomorrow, be kind.<\/p>\n\n\n\n<p>Offer them coffee.<\/p>\n\n\n\n<p>Do not ask whether they are almost finished.<\/p>\n\n\n\n<p>And, above all, do not point at a button and say:<\/p>\n\n\n\n<p><strong>\u201cCan we make that slightly bigger?\u201d<\/strong><\/p>\n\n\n\n<p>Because somewhere, deep inside that developer&#8217;s nervous system, an old CSS breakpoint is waking up.<\/p>\n\n\n\n<p>And it is looking for revenge.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are many dangerous professions in the world. Firefighter. Deep-sea diver. Bull rider. Professional cricket umpire. And then there is the front-end web developer. People assume we sit comfortably at a desk, drinking artisanal coffee while gently arranging rectangles on a screen. This is propaganda. The truth is that front-end development is a high-risk occupation&hellip;&nbsp;<a href=\"https:\/\/twobitranch.io\/index.php\/2024\/02\/27\/bruised-by-buttons\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Bruised by buttons<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/twobitranch.io\/index.php\/wp-json\/wp\/v2\/posts\/37"}],"collection":[{"href":"https:\/\/twobitranch.io\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/twobitranch.io\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/twobitranch.io\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/twobitranch.io\/index.php\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":2,"href":"https:\/\/twobitranch.io\/index.php\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":68,"href":"https:\/\/twobitranch.io\/index.php\/wp-json\/wp\/v2\/posts\/37\/revisions\/68"}],"wp:attachment":[{"href":"https:\/\/twobitranch.io\/index.php\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/twobitranch.io\/index.php\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/twobitranch.io\/index.php\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}