whoami
Lucas Jenß
cat /etc/motd
The Coding Journal ツ — Notes taken on an epic coding journey. Technical solutions, debugging notes, and practical guides from the trenches of software development.
ls -la ~/languages/
- drwxr-xr-x
- ▶ PHP
- ▶ Ruby
- ▶ Scala
- ▶ C#
- ▶ JavaScript
- ▶ Objective-C
- ▶ Shell Scripting
ls -la ~/toolchain/
- drwxr-xr-x
- ▶ Typo3
- ▶ Akka
- ▶ Capistrano
- ▶ Git
- ▶ MAMP
- ▶ Adobe Illustrator
- ▶ NSTrackingArea (Cocoa)
uname -a
- drwxr-xr-x
- ▶ Mac OS X
- ▶ Unix
Interactive SVG components: mapping Illustrator layers to CSS classes
An interactive SVG assembled in Adobe Illustrator often begins as a stack of named layers: background, icon, label, focus ring and hit area. The visual result can be excellent while the exported markup remains awkward for CSS and JavaScript. Mapping those layers to predictable class names creates a component that can be styled, queried and maintained without relying on generated IDs.
The important distinction is between identity and role. An ID should identify one element, especially when several components share a page, while a class describes what an element is or does. Illustrator commonly preserves layer names as IDs, not as useful CSS selectors, so the export needs inspection and often a small transformation step. This separation makes later refactoring less destructive.
A workable workflow starts before export: structure the artboard, name meaningful groups, remove editing debris and decide which interactions belong in the SVG. It then continues in the browser, where responsive sizing, keyboard behaviour, touch targets and analytics are tested. The result becomes a durable interface component with a traceable source of truth, rather than merely a smaller vector file.
Prepare Illustrator layers for web export
Export the artwork as SVG and open the markup in a text editor before styling it. Check the viewBox, width and height, namespaces, and the elements generated for masks, clipping paths and text. Use an SVG export mode that writes CSS properties where your browser support policy permits it. For responsive use, retain the viewBox and control rendered size from the surrounding HTML instead of freezing an Illustrator artboard into fixed pixels.
Use layer names as a controlled vocabulary rather than a record of visual styling. A root group such as volume-control can become the component scope; child layers such as volume-control__track and volume-control__thumb describe stable roles. Keep state separate: mute, selected and disabled are better represented by attributes or state classes than by names like red-icon or final-version. Document the naming convention beside the source file so another developer can apply it consistently.
Delete hidden guides, unused groups and redundant paths before export. Convert fragile text to outlines only when font substitution would be worse, and provide accessible text separately when the label carries meaning. Review blend modes, masks and filters in the target browser because Illustrator’s SVG output can rely on features that differ across rendering engines. A clean export is easier to test and produces fewer confusing overrides later.
Turn layer names into semantic classes
Classes should describe structure, not prescribe a particular colour. A component class identifies the root, element classes identify parts, and a modifier may identify a stable variant. State belongs in one source of truth, such as data-state, so CSS can react with an attribute selector and JavaScript can update the same value. This avoids the common problem where a visual class and an interaction flag disagree after a click.
A transformed SVG group might look like this:
<g id="volume-control" class="volume-control" data-state="idle">
<g id="volume-control-track" class="volume-control__track"></g>
<g id="volume-control-thumb" class="volume-control__thumb"></g>
</g>
Add classes to the relevant groups without rewriting their geometry, then style the component from an external stylesheet or the host application’s design-token layer. Scope selectors to the root class, since generic names such as .label or .active can affect unrelated SVG elements. A small build script can convert agreed layer names into classes consistently when Illustrator files are exported repeatedly.
Treat the Illustrator file and the transformed SVG as two related artefacts: one is the editable design source, and the other is a generated web asset. Keep the transformation script under version control and record ownership for both. On this journal, provenance and contact information are recorded in the site and author details, providing a practical model for avoiding anonymous, orphaned components.
Connect classes to CSS and interaction
Wire behaviour through component-scoped data attributes and delegated event listeners. For example, a listener can find the nearest [data-volume-control] ancestor, then read data-role="thumb" from the clicked target. Update data-state on that root and let CSS drive the transition. Avoid binding JavaScript to Illustrator-generated IDs, and use transforms with transform-box: fill-box when an SVG part must rotate or scale around its own centre.
This separation of host data and component internals resembles the boundary used by reusable table-view cells, where the host supplies values while the reusable view manages its internal states. In a browser SVG, that boundary also improves accessibility. Provide a clear accessible name, preserve visible focus, support Enter and Space, and ensure the clickable shape covers at least a 44 by 44 CSS-pixel touch area. A transparent hit layer can enlarge a small visual control without distorting it.
Consider the settings common to Australian users rather than testing only a fast desktop connection. Sydney and Melbourne commuters often move between mobile data, home broadband and patchy train or airport Wi-Fi, while Australian retail and banking services must support self-service journeys on a mix of iPhone, Android and older devices. If interaction events are sent to an Australian service, the Privacy Act 1988 and Australian Privacy Principles may govern that data. Public-facing accessibility work should also account for the Disability Discrimination Act 1992 and the WCAG 2.2 AA benchmark commonly used by Australian government teams.
Test the exported SVG in real conditions
Test the exported component in current Chrome, Safari, Firefox and Edge, using the browser inspector to confirm that selectors match the intended groups. Inspect the accessibility tree and keyboard order, then repeat the check with a touchscreen. For inline SVG, verify pointer-events on transparent areas; for SVG loaded through an img element, remember that its internal document is isolated, external page CSS cannot target it, and its scripts will not run.
Check layout at narrow phone widths and on a large desktop viewport. SVG scales cleanly, but fixed dimensions, text wrapping and transform origins can still break. Respect prefers-reduced-motion for animated feedback, and test forced-colours and dark modes where the design supports them. Capture visual regression screenshots for normal, hover, focus, active, disabled and error states so an Illustrator re-export cannot silently alter geometry or colour.
Watch for duplicate identifiers when the same component appears more than once. Prefix IDs by instance or convert repeated artwork into symbols and reference it with use, but test inherited styles and accessibility labels in both cases. Keep filters and masks out of hot interaction paths where possible, because repeated effects can be expensive on lower-powered phones. A quick performance trace should show smooth pointer and touch feedback under realistic animation settings.
Ship a repeatable SVG component workflow
Make the component easy to regenerate. Store the source artwork, naming rules, transformation script and any manual edits in the same repository or clearly linked project area. If people edit exported SVG directly, record why; otherwise the next export will erase those fixes. A small visual diff between generated versions catches accidental shifts, while comments explain intentional changes to class names, states or artwork.
Three practical approaches differ in where structure is translated and where interaction state is owned:
| Approach | Illustrator structure | Behaviour model | Best suited to | Main limitation |
|---|---|---|---|---|
| Direct inline SVG | Layer groups become named elements | Classes plus data-state |
One-off rich components | Hand edits can drift |
| Export then transform | Groups retain names until a script adds classes | Generated classes and attributes | Repeatable design systems | Requires a versioned build step |
Symbol and use sprites |
Symbols become reusable parts | Shared CSS with scoped classes | Icon families and repeated widgets | Instance styling and IDs need care |
Open the next Illustrator file, establish the root and part names, remove unused layers, export the SVG, inspect the markup, and add one controlled interaction through data-state. Test it with a keyboard, a finger and the browsers used by the project, then publish the SVG together with its source, transformation script and known constraints.
cat ~/interests.json
| Key | Value |
|---|---|
| editor | Terminal-first workflow |
| os | Mac OS X / Unix |
| vcs | Git, distributed version control |
| deploy | Capistrano, cron automation |
| graphics | SVG, Adobe Illustrator troubleshooting |
| networking | IP validation, SSH, VPN |
git log --oneline --reverse
Solving SVG import issues in Adobe Illustrator CS6 and CC
When importing an SVG into Illustrator, the operation fails with an unknown error [CANT]. A workaround for this Adobe-side bug.
Solving NDK build issues on OS X
Troubleshooting native development kit compilation problems on Mac OS X.
Programmatically adding PHP generated TypoScript to the backend configuration
Integrating dynamically generated TypoScript into Typo3 backend setups using PHP.
ArgumentError: Could not parse PKey: no start line
Debugging an SSH key parsing error encountered during deployment.
Validating IP-Addresses in PHP
Using PHP filter functions with flags like FILTER_FLAG_IPV4 and FILTER_FLAG_IPV6, and understanding how filter_var handles reserved IP addresses.
Cocoa: Using NSTrackingArea
A short tutorial on using Cocoa's NSTrackingArea to capture mouseEntered and mouseExited events.
cat ~/contact.txt