UX details for web developers

Implementation details shape a better web interface and prevent common UX and accessibility problems. A living checklist helps developers meet expected behavior.

CSS: Opacity is not inherited in Internet Explorer

In Internet Explorer, opacity on non-static elements may not affect child content, causing fading or hiding bugs. A non-static position on the parent restores the expected behavior.

Understanding z-index: it's about stacking contexts

z-index only matters inside a stacking context, so huge values rarely help. isolation: isolate creates a new context with minimal side effects.

Imagemagick: Batch resize images

Batch resizing images with mogrify updates files in place, while convert writes new output files for thumbnail workflows.

Accessibility: Making non-standard elements interactive

JavaScript-made controls can be mouse-only, leaving keyboard users and screen readers unable to focus or activate them. Use semantic elements, tabindex, ARIA roles, or up-clickable for accessible interaction.

Top Accessibility Errors in 2023

Top accessibility mistakes still block keyboard and screen-reader users: missing text alternatives, broken labels, and tab-order errors are common and easy to miss.

Virtual scrolling: A solution for scrolling wide content on desktops

Wide tables on desktop can be hard to scroll without moving the rest of the page or hiding the scrollbar off screen. Reusing the page scrollbar with position: sticky and translateX keeps the content centered.

Getter and setter functions for JavaScript properties

Property access can trigger custom logic in JavaScript, enabling virtual fields like fullName and read/write synchronization without explicit function calls.

RSpec: Where to put custom matchers and other support code

Custom RSpec matchers and support code need a clear home in spec/support to keep specs DRY and make shared helpers available everywhere.

Developer Soft Skills

Judging when refactoring, optimizing, canceling work, or asking for help saves time and keeps development effort focused on changes with real payoff.

How to not repeat yourself in Cucumber scenarios

Avoid duplicated Cucumber scenarios by sharing setup and assertions with step composition, helper modules, or scenario outlines. Better reuse keeps integration tests DRY and stack traces readable.

RSpec 3 allows chaining multiple expectations

Multiple RSpec checks on one subject can be chained with and or or, avoiding repeated setup and keeping a single call under test.

ActiveRecord: validate_uniqueness_of is case sensitive by default

Rails uniqueness validation treats username and USERNAME as different by default, which can conflict with MySQL’s case-insensitive comparisons and unique indexes.

Migrating from Elasticsearch to Opensearch: searchkick instructions (without downtime!)

Zero-downtime migration from Elasticsearch to OpenSearch for Searchkick apps, including staging validation, client switching, and environment-specific index settings.

You should be using the Web Animations API

Browser support is strong for the Web Animations API, which lets JavaScript animate DOM elements and await or cancel CSS transitions and animations.

Be careful when checking scopes for blankness

blank? on an ActiveRecord::Relation can load every row into memory and stall workers; use nil checks or exists?/empty? for cheap scope checks.

Rails route namespacing (in different flavors)

Rails routes can separate URL segments, helper names, and controller modules, letting you namespace controllers or change paths without affecting the other dimensions.

ES6 imports are hoisted to the top

ES modules are hoisted, so import order in source can differ from execution order and break code that depends on globals like $.

How to examine an unknown Ruby object

Inspect unfamiliar Ruby objects during debugging by listing methods, filtering names, and checking instance variables when source code is unavailable.

How to display an unsaved changes alert

Unsaved form edits can be lost when a tab closes or a full page unload occurs. beforeunload with preventDefault() triggers the browser's standard warning.

Working on the Linux command line: How to bash `cd` with autocorrect

cdspell can correct small cd typos automatically, and aliases can map common command misspellings to the intended command.

How to discard ActiveRecord's association cache

ActiveRecord association data can stay stale after changes; reset clears the cache without querying, while reload fetches fresh rows immediately.

In Chrome 121+ the now supported spec-compliant scrollbar properties override the non-standard `-webkit-scrollbar-*` styles

Chrome 121+ gives scrollbar-width and scrollbar-color precedence over ::-webkit-scrollbar-*, so existing scrollbar styling can regress unless CSS is gated by browser support.

Heads up: You should always use "current_window.resize_to" to resize the browser window in tests

Flaky browser tests can run at the wrong size on slow CI runners when window resizing returns too early; Capybara page.current_window.resize_to waits for a stable dimension.