Skip to content

Add consistency-by-default guidance for UI pattern decisions #335603

Description

@chryw

Note

Planning follow-up. This proposes a lightweight authoring and review principle, not a requirement to copy existing UI, a broad migration, or an automatic lint rule.

Problem

VS Code is built by many teams across old and new UI generations. When adding or changing a visual or interaction pattern, two opposite failure modes are possible:

  1. Unnecessary invention: a new local treatment is slightly different from an equivalent existing experience. Each difference adds customer learning load and creates another implementation to maintain.
  2. Blind reuse: an existing implementation is treated as authoritative even when it is legacy, accidental, inaccessible, inconsistent with current design direction, or simply wrong for the new user need.

Current guidance says to reuse components and follow shared design ramps, but it does not provide a repeatable way to evaluate prior art, distinguish stable conventions from historical accidents, or explain when divergence is justified.

Recent work on #335583 illustrates both sides. Reusing the existing GitHub hover components avoided a new card language, but a broader comparison still found inherited choices that should not be propagated unchanged: an outdated title hierarchy, duplicate boundary padding, an unnecessary divider, and submenu chrome that differed from the standard popup containing it.

Proposed principle

Consistency by default, intentional divergence. Before introducing or changing a visual or interaction pattern, identify the closest analogous experiences and canonical guidance. Reuse shared semantics, behavior, and component contracts when their roles match, because unnecessary variation increases customer learning load. Treat existing implementations as evidence, not authority: do not preserve known debt, deprecated patterns, accessibility problems, or accidental styling. Diverge when a clear user need, accessibility requirement, simplification, or current design direction calls for it; make the reason explicit and decide whether the shared owner should evolve.

The goal is familiarity without stagnation: like things should behave alike unless a difference does useful work.

Suggested lightweight workflow

For UI work, proportionate to the size and risk of the change:

  1. Name the role and user task. Compare surfaces that serve the same purpose, not merely elements that look similar.
  2. Inspect representative prior art and canonical guidance. Prefer shared primitives, current design guidance, and actively maintained/recently accepted surfaces over an isolated historical example.
  3. Separate invariants from accidents. Identify which semantics, interactions, accessibility behavior, ownership boundaries, and visual roles should stay consistent; do not copy incidental DOM or CSS.
  4. Classify the decision. State what is reused, adapted, or new. For a small change this can be implicit in the diff or review description; larger explorations may benefit from a short provenance table.
  5. Justify divergence. A new treatment should answer an unmet user need, remove complexity, improve accessibility, or advance an accepted design direction—not exist only because it was easy to implement locally.
  6. Choose the right owner. If the improved behavior should apply to equivalent surfaces, evolve the shared component or contract when there is demonstrated production need. Otherwise keep a clearly scoped local exception.
  7. Validate equivalent scenarios. Use production components and focused fixtures where useful; check the relevant density, theme, keyboard, and accessibility states rather than validating only the new happy path.

Resolving conflicting prior art

Existing code will often disagree. Use this evidence order as a review heuristic, not a mechanical ranking:

  1. Accepted canonical design/accessibility guidance and explicit component contracts.
  2. Shared primitives and actively maintained, recently reviewed comparable surfaces.
  3. Local conventions in the feature area, when they do not conflict with the above.
  4. Isolated legacy implementations, which are useful evidence but not precedent by default.

When no direction is clearly established, preserve behavior for narrow maintenance work and surface the uncertainty. For a genuinely new pattern, seek product/design input rather than selecting whichever old example is easiest to copy.

Guardrails

  • Do not require exhaustive repository archaeology or a fixed number of examples.
  • Do not make “most common” or “oldest” synonymous with correct.
  • Do not force reuse, inheritance, or a shared abstraction when roles differ.
  • Finding a related component does not imply it must be extended; a documented no-reuse conclusion is valid.
  • Do not block experiments. Treat them as explicit experiments, keep them scoped, and use what is learned to decide whether a pattern should become shared.
  • Do not require competitor research for routine UI changes.
  • Do not duplicate mutable component inventories or token tables across instructions and skills.
  • Keep automatic enforcement out of scope until repeated accepted work reveals a precise mechanically checkable rule.

Guidance placement

Coordinate with #335370's source-of-truth model:

  • Add a short stable principle/router to the auto-applied design instruction.
  • Keep the detailed workflow, examples, and feedback language in the canonical design-philosophy skill.
  • Let layout, theming, accessibility, and component-fixture skills retain their domain-specific techniques rather than repeating this full checklist.

This is broader than #335346's candidate one relationship, one owner composition heuristic. That guidance is one example of applying the principle; this issue covers visual and interaction pattern decisions generally.

Acceptance criteria

  • Canonical UI guidance states consistency by default, intentional divergence or an equivalent high-level principle.
  • Guidance explicitly says existing code is evidence, not authority, and warns against copying legacy or accidental patterns.
  • A lightweight, proportional prior-art workflow covers reuse, adaptation, new work, and justified exceptions.
  • Guidance protects accessibility improvements, modernization, simplification, necessary product differences, and experimentation.
  • The workflow discourages unnecessary local variants and customer learning load without requiring forced abstraction.
  • The detailed workflow has one canonical owner and auto-applied instructions remain concise, consistent with Reduce drift across Copilot instructions, skills, and design-token sources #335370.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions