Skip to content

fix(web): focus-visible layering bugs + enable stylelint - #22

Merged
iskhakovt merged 5 commits into
mainfrom
chore/stylelint
Apr 11, 2026
Merged

iskhakovt merged 5 commits into
mainfrom
chore/stylelint

Conversation

@iskhakovt

@iskhakovt iskhakovt commented Apr 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Enable stylelint for packages/web/src/index.css with Tailwind v4 syntax support, fix everything it flagged, and fix two latent focus-indicator bugs that the review surfaced.

Tooling

  • Adds stylelint, stylelint-config-standard, @dreamsicle.io/stylelint-config-tailwindcss (the dreamsicle config teaches stylelint Tailwind v4's @theme / @apply / @utility syntax; no stylistic opinions).
  • pnpm lint now runs biome + stylelint; pre-commit picks this up automatically.
  • pnpm lint:fix runs both with auto-fix.
  • Exception overrides: selector-no-vendor-prefix for ::-webkit-scrollbar* (no standard alternative), property-no-vendor-prefix for font-smoothing (non-standard property, WebKit/Gecko only).

CSS fixes

  • Keyframes renamed to kebab-case — fadeSlideIn, floatA, floatB, progressShine, softPress. CR review flagged this on feat(web): polish Landing, Question flow, and Comparison screens #11. celebrate already passed (single word).
  • Modern color-function notation — rgba(208, 128, 88, 0.4) → rgb(208 128 88 / 40%) throughout. Alpha as percentage.
  • color-mix() for .celebrate pulse — shadow now derives from --color-accent via color-mix(in srgb, var(--color-accent) 40%, transparent) instead of a hardcoded hex literal. Palette changes propagate automatically.
  • transition: all on input[type=checkbox] → explicit background-color, border-color. Avoids the well-known perf cost of animating every property on hover/check.
  • Google Fonts moved from CSS @import to HTML <link> with rel=preconnect for fonts.googleapis.com + fonts.gstatic.com. CSS @import blocks stylesheet parsing until the fetch completes; <link> in the head is parallelizable and preconnect warms the TCP/TLS handshake.
  • Auto-fixes: empty-line-before rules, import-notation, alpha-value-notation, split multi-declaration single-line rules in celebrate.

Focus-indicator fix (*:focus-visible into @layer base)

The universal keyboard-focus outline was unlayered, so it won the cascade against Tailwind utilities on elements that had explicitly opted into their own focus treatment. Two latent visual bugs on the four form inputs carrying focus:outline-none focus:ring-2 focus:ring-accent/30 (GroupSetup, Invite, PersonApp):

  1. Double focus indicator — the unlayered rule's accent-light outline drew on top of the Tailwind ring instead of being overridden by outline-none.
  2. Border-radius jumping md → sm on keyboard focus. The rule set border-radius: var(--radius-sm) on :focus-visible, which reshapes the element itself (not the outline as the author likely intended — outlines follow the element's own shape regardless).

Moving the rule into @layer base fixes both: utilities beat base, so the form inputs now show only the ring and keep their md corners. Non-form elements (no focus:outline-none usage anywhere else — verified via grep) still get the accent-light outline. Also drops the border-radius line entirely since it was doing the wrong thing.

Test plan

  • pnpm lint (biome + stylelint) clean
  • pnpm typecheck clean
  • pnpm test — 289 tests passing
  • pnpm --filter @spreadsheet/web build — builds cleanly
  • Visual check in browser: welcome stagger animation, celebrate pulse, floating blobs, checkbox transitions
  • Keyboard-tab to each of the 4 text inputs: only the ring shows, corners stay md
  • Keyboard-tab to a button / tab widget: accent-light outline shows
  • Network tab: Lexend font loads from <link> (not CSS @import) and preconnect fires

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Style

    • Optimized font loading performance with preconnect and swap display strategy.
    • Refined CSS animations and focus styling for improved accessibility.
  • Chores

    • Added CSS linting configuration and validation to development workflow.

Add stylelint with stylelint-config-standard + Tailwind v4 syntax
support via @dreamsicle.io/stylelint-config-tailwindcss. Wires into
pnpm lint (which runs on pre-commit) so CSS drift gets caught going
forward.

CSS fixes applied:
- Rename @Keyframes to kebab-case (fade-slide-in, float-a, float-b,
  progress-shine, soft-press) — CR flagged this on #11.
- Modern color-function notation: rgba(208 128 88 / 40%) instead of
  rgba(208, 128, 88, 0.4); alpha as percentage.
- color-mix() for the .celebrate pulse shadow so it follows
  --color-accent instead of a hardcoded hex literal.
- Replace `transition: all` on input[type=checkbox] with explicit
  background-color + border-color — avoids the perf cost of animating
  every property.
- Move Google Fonts from CSS @import (render-blocking) to <link> in
  index.html with rel=preconnect — eliminates the FOUC window where
  the stylesheet waits on font CSS before it can parse Tailwind.

Not in scope: wrapping base styles in @layer base. Unlayered CSS
currently has higher priority than any layer, which is what keeps
*:focus-visible winning against Tailwind's focus:outline-none on
form inputs (GroupSetup, Invite, PersonApp). Moving those rules to
a layer without reworking focus handling would break keyboard focus
rings. Separate concern.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 11, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

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

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 58 seconds.

⌛ 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 22afd968-d2d4-4e92-874b-ca387d03196f

📥 Commits

Reviewing files that changed from the base of the PR and between c097b9f and 11b6fd7.

📒 Files selected for processing (1)
  • todo.md
📝 Walkthrough

Walkthrough

Added a Stylelint config and npm scripts for CSS linting, loaded the Lexend font via Google Fonts in the web HTML, and refactored site CSS: removed font @import, modernized gradient syntax, renamed keyframes/animations to kebab-case, tightened checkbox transitions, scoped focus outlines, and replaced a hardcoded shadow with a color-mix using the accent token.

Changes

Cohort / File(s) Summary
Stylelint config & scripts
\.stylelintrc.json, package.json
Added .stylelintrc.json extending stylelint-config-standard and @dreamsicle.io/stylelint-config-tailwindcss; enabled vendor-prefix rules and whitelisted scrollbar pseudo-elements and font-smoothing properties. Added lint:css script, updated lint / lint:fix, and added stylelint devDependencies.
HTML font preload
packages/web/index.html
Added preconnect links to Google Fonts and a stylesheet <link> to load the Lexend font family with multiple weights and display=swap.
CSS refactor & animations
packages/web/src/index.css
Removed Google Fonts @import; converted body gradients to rgb(... / alpha) syntax; renamed keyframes/animation identifiers to kebab-case and updated uses; replaced hardcoded rgba() in celebrate shadow with color-mix(in srgb, var(--color-accent) ...); narrowed checkbox transition to background-color and border-color; moved *:focus-visible into @layer base and applied whitespace/formatting adjustments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through lines of stylesheet green,
Nibbled imports and polished the sheen,
I kebabbed keyframes and tuned the light,
Preconnected fonts to make pages bright,
A linting cheer — the web looks just right!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main changes: fixing focus-visible layering bugs and enabling stylelint for CSS linting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/stylelint

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Line 13: The lint:css npm script uses single quotes around the Stylelint glob
which fails on Windows shells; update the "lint:css" script (the package.json
key "lint:css") to use escaped double quotes for the glob pattern instead of
single quotes so the pattern "packages/web/src/**/*.css" is passed correctly on
all platforms.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 13544f3f-b0d6-416f-9978-fec2ec6a95b2

📥 Commits

Reviewing files that changed from the base of the PR and between 984614d and aaa7e9a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • .stylelintrc.json
  • package.json
  • packages/web/index.html
  • packages/web/src/index.css

Comment thread package.json
"lint:fix": "biome check --write .",
"lint": "biome check . && pnpm lint:css",
"lint:fix": "biome check --write . && pnpm lint:css --fix",
"lint:css": "stylelint 'packages/web/src/**/*.css'",

@coderabbitai coderabbitai Bot Apr 11, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

Do npm/pnpm scripts run via Windows cmd treat single quotes as argument delimiters for commands like: stylelint 'packages/web/src/**/*.css'?

💡 Result:

No, Windows cmd.exe does not treat single quotes (') as argument delimiters. Single quotes have no special meaning in cmd.exe parsing; they are treated as literal characters. cmd.exe uses only double quotes (") for quoting arguments containing spaces. For the example stylelint 'packages/web/src//.css' in an npm or pnpm script executed via cmd.exe: - The single quotes are passed literally to stylelint. - stylelint receives arguments: stylelint, packages/web/src//.css (split on space, ignoring the quotes). - No files match because 'packages/web/src//.css' is not a valid glob pattern (literal quotes interfere). Use double quotes instead: "stylelint "packages/web/src//.css"" in package.json. This is evidenced by multiple sources confirming cmd.exe ignores single quotes (18,16,21), stylelint-specific issues requiring double quotes on Windows (11,12,13), and npm/pnpm script examples replacing single with escaped double quotes (2,4).

Citations:


Use double quotes for the Stylelint glob to fix command execution on Windows platforms.

Single quotes in the stylelint glob pattern are passed literally to the command on Windows cmd.exe, making the glob pattern invalid (e.g., 'packages/web/src/**/*.css' becomes a literal string with quotes rather than a glob). Use escaped double quotes instead for cross-platform compatibility.

Proposed change
-    "lint:css": "stylelint 'packages/web/src/**/*.css'",
+    "lint:css": "stylelint \"packages/web/src/**/*.css\"",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"lint:css": "stylelint 'packages/web/src/**/*.css'",
"lint:css": "stylelint \"packages/web/src/**/*.css\"",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 13, The lint:css npm script uses single quotes around
the Stylelint glob which fails on Windows shells; update the "lint:css" script
(the package.json key "lint:css") to use escaped double quotes for the glob
pattern instead of single quotes so the pattern "packages/web/src/**/*.css" is
passed correctly on all platforms.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Verified but not fixing — Windows isn't a supported platform baseline here.

Technically correct in isolation: cmd.exe and PowerShell don't strip single quotes the way POSIX sh does, so stylelint 'packages/web/src/**/*.css' would pass the literal glob-with-quotes to stylelint and fail to match. But a Windows contributor can't actually run the toolchain without a POSIX shell for reasons that predate this PR:

  • .husky/pre-commit uses set -e, command -v, || { ... } — cmd.exe can't parse that. Windows contributors must already be on Git Bash or WSL, both of which handle single quotes fine.
  • CI is ubuntu-latest across ci.yml + publish.yml.
  • No cross-env / cross-spawn / shx in devDependencies, and no other script in package.json uses defensive Windows quoting.

Fixing lint:css alone would be theater — the pre-commit hook still excludes cmd.exe users. If Windows support ever becomes a real concern it needs a holistic pass (husky shim, documented shell requirement, CI matrix), not a one-off quote change.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@iskhakovt, that's a well-reasoned explanation — the .husky/pre-commit POSIX dependency alone makes the single-quote change moot for cmd.exe users. Acknowledged; I won't flag this pattern again in the project.


✏️ Learnings added
Learnt from: iskhakovt
Repo: iskhakovt/spreadsheet PR: 22
File: package.json:13-13
Timestamp: 2026-04-11T23:00:07.155Z
Learning: In iskhakovt/spreadsheet, Windows (cmd.exe/PowerShell) is NOT a supported contributor platform. The toolchain requires a POSIX shell (Git Bash or WSL) because `.husky/pre-commit` uses `set -e`, `command -v`, and `|| { ... }` constructs. CI runs exclusively on ubuntu-latest. There is no cross-platform tooling (cross-env, cross-spawn, shx) in devDependencies. Single-quoted globs in package.json scripts (e.g., `stylelint 'packages/web/src/**/*.css'`) are intentional and acceptable.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: CR
Repo: iskhakovt/spreadsheet PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-11T21:10:12.512Z
Learning: Applies to biome.json : Use Biome for code formatting and linting in the root devDependencies

Learnt from: CR
Repo: iskhakovt/spreadsheet PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-11T21:10:12.512Z
Learning: Applies to {packages/*/package.json,package.json} : Use pnpm workspaces for monorepo; workspace dependency: spreadsheet/shared: workspace:*

Learnt from: CR
Repo: iskhakovt/ai-assistant PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-11T18:31:14.361Z
Learning: Run `pnpm typecheck && pnpm lint && pnpm test` after making changes to verify correctness.

Learnt from: CR
Repo: iskhakovt/cogmo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-11T21:40:46.369Z
Learning: Run `pnpm typecheck && pnpm lint && pnpm test` after making changes to verify correctness

Learnt from: CR
Repo: iskhakovt/cogmo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-11T21:40:46.369Z
Learning: Applies to **/*.integration.test.ts : Re-record LLM mock fixtures via `pnpm test:record` when requests change (new tools, new prompts, etc.). CI runs in strict mode.

Learnt from: CR
Repo: iskhakovt/spreadsheet PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-11T21:10:12.512Z
Learning: style commit type means code formatting only (whitespace, semicolons, lint fixes), not visual/UX changes; UI polish is feat

Learnt from: CR
Repo: iskhakovt/spreadsheet PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-11T21:10:12.512Z
Learning: Applies to packages/web/src/**/*.tsx : Use React 19 and Vite 8 for frontend with Tailwind and shadcn/ui (Base UI primitives)

iskhakovt and others added 2 commits April 11, 2026 23:49
The universal keyboard-focus outline was unlayered, so it won the
cascade against Tailwind utilities on elements that explicitly opted
into their own focus treatment. Two latent visual bugs on the four
form inputs carrying `focus:outline-none focus:ring-2 focus:ring-accent/30`:

  1. Double focus indicator — the unlayered rule's accent-light
     outline drew *on top of* the Tailwind ring instead of being
     overridden by `outline-none`.
  2. Border-radius jumped from md → sm on keyboard focus. The rule
     set `border-radius: var(--radius-sm)` on :focus-visible, which
     reshapes the element (not the outline as the author likely
     intended — outlines follow the element's own shape regardless).

Moving the rule into @layer base fixes both: utilities beat base, so
the form inputs now show only the ring and keep their md corners.
Non-form elements (no focus:outline-none usage anywhere else in the
codebase — verified via grep) still get the accent-light outline.

Also drops the border-radius line entirely since it was doing the
wrong thing.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/web/src/index.css (1)

183-187: Optional: deduplicate focus-visible declarations.

Line 183-187 duplicates the checkbox focus outline already declared at Line 178-181. Keeping one source of truth would reduce maintenance noise.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web/src/index.css` around lines 183 - 187, There are duplicate
focus-visible rules: the generic selector *@layer base { *:focus-visible { ... }
}* duplicates the checkbox-specific focus outline declared earlier; remove the
redundant rule or consolidate both into a single source of truth (either keep
the generic *:focus-visible block and remove the checkbox-specific one, or vice
versa), ensuring the outline and outline-offset properties are declared only
once (refer to the *:focus-visible and the input[type="checkbox"]:focus-visible
selectors) so maintenance is simplified.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/web/src/index.css`:
- Around line 183-187: There are duplicate focus-visible rules: the generic
selector *@layer base { *:focus-visible { ... } }* duplicates the
checkbox-specific focus outline declared earlier; remove the redundant rule or
consolidate both into a single source of truth (either keep the generic
*:focus-visible block and remove the checkbox-specific one, or vice versa),
ensuring the outline and outline-offset properties are declared only once (refer
to the *:focus-visible and the input[type="checkbox"]:focus-visible selectors)
so maintenance is simplified.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e79fc723-5f03-4892-be3a-b4ab3122471c

📥 Commits

Reviewing files that changed from the base of the PR and between bdf9a0f and 67f2b4a.

📒 Files selected for processing (1)
  • packages/web/src/index.css

@iskhakovt iskhakovt changed the title chore(web): enable stylelint and modernize CSS fix(web): focus-visible layering bugs + enable stylelint Apr 11, 2026
Declared the same outline + offset as the universal *:focus-visible
in @layer base. None of the four checkboxes in the codebase carry
any className, so no Tailwind utility exists that would override the
base rule — the element-specific block was pure duplication.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@iskhakovt

Copy link
Copy Markdown
Owner Author

Nitpick: deduplicate focus-visible declarations in packages/web/src/index.css

Verified and fixed in c097b9f. The input[type="checkbox"]:focus-visible block declared identical values to the universal rule in @layer base, and none of the four checkboxes in the codebase carry any className at all (grepped Landing.tsx, Invite.tsx, Summary.tsx) — so no Tailwind utility exists that would ever override the base rule. The element-specific block was pure duplication.

CSS toolchain revisit is landing in this PR (stylelint enabled,
modern color syntax, color-mix, fonts moved to HTML). The focus-
visible layering bug surfaced during review shows why visual
regression tests matter: cascade-layer accidents are invisible to
typecheck + unit tests + E2E flow tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@iskhakovt
iskhakovt enabled auto-merge (squash) April 11, 2026 23:14
@iskhakovt
iskhakovt merged commit 0c16723 into main Apr 11, 2026
7 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.3.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant