Skip to content

fix(elements): scope docs dt style to main content - #682

Merged
wesleyboar merged 2 commits into
TACC:mainfrom
wesleyboar:fix/html-elements-docs-dt-scope
Aug 6, 2026
Merged

fix(elements): scope docs dt style to main content#682
wesleyboar merged 2 commits into
TACC:mainfrom
wesleyboar:fix/html-elements-docs-dt-scope

Conversation

@wesleyboar

@wesleyboar wesleyboar commented Aug 6, 2026

Copy link
Copy Markdown
Member

Overview

Properly fixes syntax bug that browser and compile were fixing.

Remove unscoped & from html-elements.docs.css.

Details

html-elements.docs.css styles dt with a top-level & dt { ... } rule that has no enclosing selector, so & resolves to :scope (the whole document) instead of scoping to main content like the sibling element styles do. Flagged by Qodo on #680.

Related

Changes

  • deleted the & from dt rule

Testing

  1. npm run build
  2. Confirm dist/core-styles.docs.css has dt{font-weight:var(--medium)} instead of dt{...}.

The `& dt` rule had no enclosing selector, so `&` resolved to `:scope`
(i.e. the whole document) instead of scoping to main content like the
sibling element styles do.

Relates-to TACC#680 (discussion)
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Scope docs dt styling to main content selector

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Scope docs dt styling to :--main-content instead of global :scope.
• Restore selectors.css import so the custom main-content selector resolves.
• Regenerate dist docs CSS outputs with the corrected selector.
Diagram

graph TD
  A["src/.../html-elements.docs.css"] --> B["tools/selectors.css"] --> C(["Build pipeline"]) --> D["dist/elements/html-elements.docs.css"] --> E["dist/core-styles.docs.css"] --> F["Docs page (main)"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Make selector explicit (avoid top-level nesting)
  • ➕ Removes the possibility of & accidentally resolving to :scope again
  • ➕ Clearer in compiled output and simpler to reason about
  • ➖ Loses consistency with nested patterns used elsewhere in the codebase
  • ➖ May encourage mixed styling conventions across element files
2. Add a lint/build guard against top-level `&`
  • ➕ Prevents the same class of scoping bug across the codebase
  • ➕ Catches issues pre-merge rather than via downstream diffs/tools
  • ➖ Requires tooling changes (stylelint/postcss config) and team buy-in
  • ➖ May need rule exceptions for legitimate advanced nesting cases

Recommendation: The PR’s approach (restore the selector definitions import and wrap the dt rule in :where(:--main-content)) is the best immediate fix because it matches the established cms pattern and preserves existing authoring style. Consider a follow-up lint/build rule to detect top-level & usage to prevent recurrence.

Files changed (3) +8 / -2

Bug fix (3) +8 / -2
core-styles.docs.cssUpdate compiled docs bundle to scope 'dt' rule to main content +1/-1

Update compiled docs bundle to scope 'dt' rule to main content

• Replaces the unintended global ':scope dt{...}' rule with a main-content-scoped selector in the compiled docs bundle output. Ensures 'dt' font-weight styling only applies within the page’s main content region.

dist/core-styles.docs.css

html-elements.docs.cssUpdate compiled elements docs CSS to use main-content-scoped 'dt' selector +1/-1

Update compiled elements docs CSS to use main-content-scoped 'dt' selector

• Updates the compiled 'html-elements.docs.css' to emit ':where(:is([role=main],main)) dt{...}' instead of ':scope dt{...}'. Aligns the elements docs output with intended scoping semantics.

dist/elements/html-elements.docs.css

html-elements.docs.cssRestore selectors import and wrap 'dt' rule in ':--main-content' +6/-0

Restore selectors import and wrap 'dt' rule in ':--main-content'

• Re-adds the 'selectors.css' import so ':--main-content' is available. Wraps the nested '& dt' rule in ':where(:--main-content)' to prevent '&' from resolving to global ':scope'.

src/lib/_imports/elements/html-elements.docs.css

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

wesleyboar added a commit to wesleyboar/Core-Styles that referenced this pull request Aug 6, 2026
…instead

Superseded by merging TACC#682 in next commit, so the fix
is properly sourced from main rather than living only on this branch.
Simpler than scoping to main content: the `&` was unnecessary since
the rule already applied everywhere via `:scope` (same net effect as
no `&` at all), so just drop it instead of adding new scoping.
@wesleyboar
wesleyboar merged commit f1ec0c7 into TACC:main Aug 6, 2026
@wesleyboar
wesleyboar deleted the fix/html-elements-docs-dt-scope branch August 6, 2026 15:43
wesleyboar added a commit that referenced this pull request Aug 6, 2026
main's tip (#682) was already applied to epic/v3 via #680's chain
propagation, but #680 was squash-merged, severing epic/v3's ancestry
link to main. Recording this merge with the 'ours' strategy (verified
zero net content change) to restore that link so future `git merge
main` operations compute the correct merge-base instead of redoing
already-resolved conflicts.
wesleyboar added a commit that referenced this pull request Aug 6, 2026
epic/v3's content (incl. main, via #680/#682) was already applied to
epic/v3--reorg via #681's chain propagation, but #681 was squash-merged,
severing the ancestry link again (same issue as #680 on epic/v3).
Recording this merge with the 'ours' strategy (verified zero net
content change) so future `git merge epic/v3` (and transitively
`git merge main`) operations compute the correct merge-base.
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.

1 participant