Skip to content

fix: move FrameworkSelector + ConditionalQuestionnaire styles to docs.css for production builds#472

Merged
riderx merged 5 commits intomainfrom
fix/docs-framework-selector-css
Feb 14, 2026
Merged

fix: move FrameworkSelector + ConditionalQuestionnaire styles to docs.css for production builds#472
riderx merged 5 commits intomainfrom
fix/docs-framework-selector-css

Conversation

@WcaleNieWolny
Copy link
Contributor

@WcaleNieWolny WcaleNieWolny commented Feb 14, 2026

Problem

Framework selector buttons on docs pages (e.g., /docs/plugins/updater/notify-app-ready/) display as unstyled full-size images in production but look correct in dev mode.

Root Cause

Astro drops <style> blocks (both scoped and is:global) from components imported inside MDX content collection pages during static build. The HTML output has the scoped class attributes but zero CSS rules in the built CSS files.

Solution

Moved all FrameworkSelector and ConditionalQuestionnaire styles to src/css/docs.css, which is included via Starlight's customCss config and is guaranteed to be bundled in production builds.

Files Changed

  • src/css/docs.css — Added styles for FrameworkSelector and ConditionalQuestionnaire components
  • src/components/FrameworkSelector.astro — Minor: <style><style is:global> (for clarity, though styles now live in docs.css)

Before/After Screenshots

Production Before Fix (Broken)

Framework selector buttons appear as full-size unstyled images instead of compact button groups.
See: prod-page.png

Local Build Before Fix (Broken)

Same issue as production—styles are stripped during build.
See: built-page.png

Local Build After Fix (Correct)

Framework selector buttons display correctly with proper styling and layout.
See: built-fixed.png

Dev Server (Reference)

Dev server always worked correctly because Astro's dev mode preserves component styles.
See: dev-page.png

Testing

  • ✅ Dev server (npm run dev) — buttons render correctly
  • ✅ Local build (npm run build) — buttons render correctly after fix
  • ✅ Production build — buttons render correctly after fix

Summary by CodeRabbit

  • New Features

    • Framework selector interface with interactive buttons, icons, and color-coded visual states
    • Multi-step questionnaire component with numbered steps and progression indicators
    • Code diff visualization showing additions and removals with distinct styling
  • Style

    • Updated and centralized styling for components with responsive adjustments for smaller viewports

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2026

Warning

Rate limit exceeded

@WcaleNieWolny has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Removed component-scoped <style> blocks from FrameworkSelector.astro and ConditionalQuestionnaire.astro and moved those styles into a new global stylesheet src/css/docs.css; runtime behavior and exported signatures are unchanged. Styles now live in the added CSS file.

Changes

Cohort / File(s) Summary
Components — scoped style removal
src/components/FrameworkSelector.astro, src/components/ConditionalQuestionnaire.astro
Removed inline component <style> blocks and left notes that styles are defined externally; DOM/event logic unchanged.
Global stylesheet
src/css/docs.css
Added ~370 lines of CSS covering FrameworkSelector (framework-button, icons, per-framework color tokens, responsive/selected/hover states) and ConditionalQuestionnaire (multi-step layout, numbered steps, connectors, question buttons, diff-added/diff-removed visuals, warnings, responsive tweaks).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through styles both bold and small,
Pulled inline sheets and placed them all,
In docs.css the colors play,
Buttons, steps, and diffs now sway,
A tidy hop — the site stands tall.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: moving styles from component <style> blocks to external docs.css to fix production build issues where Astro strips component styles from MDX pages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/docs-framework-selector-css

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a59695bb0e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/FrameworkSelector.astro (1)

63-104: ⚠️ Potential issue | 🟡 Minor

Missing :focus-visible style on .framework-button.

There's no :focus or :focus-visible rule for the framework buttons. Keyboard users tabbing through the selector won't see a visible focus indicator beyond the browser default (which may be suppressed by the custom border/background). As per coding guidelines, all interactive elements must have visible focus states.

Proposed fix (add to the style block or docs.css)
+ .framework-button:focus-visible {
+   outline: 2px solid var(--framework-border);
+   outline-offset: 2px;
+ }
🤖 Fix all issues with AI agents
In `@src/css/docs.css`:
- Around line 662-684: Add visible keyboard focus styles for the interactive
elements by implementing :focus-visible rules for .question-btn and
.react-framework-buttons .framework-button; specifically, update the CSS to
include a .question-btn:focus-visible selector (and .react-framework-buttons
.framework-button:focus-visible) that applies a clear outline or border-color
(e.g., var(--sl-color-blue)), maintains sufficient contrast (adjust background
or color if needed), and includes the same transition used for hover so keyboard
focus is visually consistent with hover/selected states.
- Around line 594-600: The global .sl-steps rules are too broad and interactive
elements lack visible keyboard focus; scope the rules to the questionnaire by
changing selectors to `#questionnaire-steps` .sl-steps (or move the block under
the `#questionnaire-steps` container) and add :focus-visible styles for the
interactive controls (selectors .question-btn and .framework-button) so keyboard
focus is visible (e.g., outline and outline-offset). Also remove or consolidate
the duplicate definitions so styling exists in one place (either
src/css/docs.css or the Astro component) to avoid drift.
🧹 Nitpick comments (3)
src/components/FrameworkSelector.astro (1)

51-220: Duplicate CSS: styles here and in docs.css are both global and nearly identical.

Since Line 51 now makes this <style is:global>, these rules will coexist with the identical block in docs.css. This means any future style tweak must be synchronized in two places. Consider removing the styles from one location — either keep them only in docs.css (the stated production fix) and strip this block down to a comment/reference, or remove them from docs.css.

src/css/docs.css (2)

786-802: Hardcoded diff colors may have poor contrast in light mode.

The green (#22c55e) and red (#ef4444) diff text colors are hardcoded. On a light background, these may not meet WCAG contrast requirements. Consider using CSS custom properties that adapt to the theme, or verify contrast ratios in light mode.


597-651: Stylelint violations: missing empty lines before declarations.

The linter flagged Lines 597, 639, and 651 for declaration-empty-line-before. These are minor formatting issues.

Fix: add blank lines before the flagged declarations
 .sl-steps {
   --bullet-size: calc(var(--sl-line-height) * 1rem);
   --bullet-margin: 0.375rem;
+
   list-style: none;
 .sl-steps > ol > li::after {
   --guide-width: 1px;
+
   content: '';
 .sl-steps > ol > li > :first-child {
   --lh: calc(1em * var(--sl-line-height));
   --shift-y: calc(0.5 * (var(--bullet-size) - var(--lh)));
+
   transform: translateY(var(--shift-y));

@WcaleNieWolny
Copy link
Contributor Author

Before / After Screenshots

Before (Production — broken)

Framework selector buttons render as full-size unstyled images:

prod-cropped

After (Dev server — fixed)

Framework selector buttons render as compact styled cards in a grid:

dev-cropped

Also in this update: removed redundant <style> blocks from FrameworkSelector.astro and ConditionalQuestionnaire.astro — styles now live exclusively in src/css/docs.css.

…o interactive buttons

- Scope all .sl-steps selectors under #questionnaire-steps to avoid
  overriding Starlight's native step component styles elsewhere
- Add :focus-visible outlines to .framework-button, .question-btn,
  and .react-framework-buttons .framework-button for keyboard accessibility

Addresses CodeRabbit review feedback on PR #472.
Change font-family from var(--sl-font) to inherit so buttons get the
full Starlight font stack with fallbacks. Bump font-size from
var(--sl-text-sm) to var(--sl-text-body) to match surrounding text.
var(--sl-font-mono) only resolves to 'IBM Plex Mono' without fallbacks.
When that font isn't loaded, code blocks fall back to the browser's
default proportional font. Add the same fallback stack Starlight uses
for its own <code> elements.
@sonarqubecloud
Copy link

@riderx riderx merged commit a00fa2e into main Feb 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants