Decisions about front-end
Architectural decision records tagged with front-end
-
acceptedEnforce SDC Schema Validation
Without enforced schema validation, Single Directory Components can silently accept incorrect or missing props, leading to runtime errors and inconsistent rendering.
-
acceptedLoad JavaScript libraries conditionally
Loading all JavaScript globally increases initial page weight and slows down pages that don't need it.
-
acceptedUse data-drupal-selector to target form elements in JavaScript
Classes and IDs are unstable JavaScript targets in Drupal, while data-drupal-selector is a stable hook provided by the Form API.
-
acceptedRespect prefers-reduced-motion for all animations and transitions
Users with vestibular disorders rely on the prefers-reduced-motion media query to disable or reduce motion that can cause discomfort.
-
acceptedUse Stylelint
Using Stylelint helps prevent errors and keeps code in a consistent format.
-
acceptedSelf-host Third-Party Static Assets
Third-party hosted assets (e.g. web fonts, icon libraries) can lead to performance, privacy, and reliability issues. These include GDPR violations, extra DNS lookups, and outages outside the organization control.
-
acceptedLayer elements deliberately with stacking contexts
Overlap elements predictably by creating new stacking contexts for
z-indexvalues. -
acceptedUse SVG view box instead of width and height
Using viewBox improves maintainability.
-
acceptedEnforce Twig coding standards with automatic linting
Linters like twigcs keep code more consistent and readable
-
acceptedAvoid using jQuery
jQuery is an unnecessary dependency for modern browsers.
-
acceptedUse relative units in CSS for resizable content
Using relative units improves accessibility by ensuring that text and content does not overlap when zooming web pages or changing the base font size.
-
acceptedUse SVGs for icons
Using SVGs for icons has the best display, performance, and accessibility
-
acceptedLoad JavaScript as external resource with defer attribute
Loading JavaScript as deferred has the best default performance
-
deprecatedLoad JavaScript as external resource with async and defer attributes
Loading JavaScript as async & deferred has the best default performance
-
acceptedUse JavaScript strict mode
Opt in to settings that raise errors for problematic code.
-
acceptedUse SMACSS to organize CSS within projects
Organizing CSS within projects the same way Drupal organizes its CSS establishes a consistent pattern.
-
acceptedUse TypeScript for pure JavaScript development
Strictly typed languages like TypeScript avoid unexpected behavior, prevent bugs, and improve code maintainability.
-
acceptedUse CSS Logical Properties
Decoupling styles from a language's writing direction makes them easier to maintain across translations.