Skip to content

[2.x] fix: keep icons whose style carries meaning out of the forced style - #4873

Merged
imorland merged 1 commit into
2.xfrom
im/preserve-semantic-icon-styles
Jul 31, 2026
Merged

[2.x] fix: keep icons whose style carries meaning out of the forced style#4873
imorland merged 1 commit into
2.xfrom
im/preserve-semantic-icon-styles

Conversation

@imorland

Copy link
Copy Markdown
Member

Follow-up to #4868, which added the forced FontAwesome style setting along with a noStyleOverride escape hatch for icons that shouldn't be restyled. This applies that hatch where it's actually needed.

Changes proposed in this pull request

An admin who forces a style is asking for uniform icons — but a few icons use their weight to convey state, and flattening those loses information rather than restyling it:

Icon What forcing a style does
Online indicator (fa-solid fa-circle) A filled dot becomes a thin ring under fa-light/fa-duotone; "online" stops reading as online
Subscription star (fa-regular vs fa-solid fa-star) Following and not-following render identically — the user can no longer tell which state they're in

Fixed by opting those out:

  • common/helpers/userOnline and forum/components/UserCard — the online dot (two separate copies of it).
  • subscriptions' SubscriptionMenu (menu rows and the split-button) and addSubscriptionControls (the discussion controls item).

DetailedDropdownItem needed a small widening to make this possible: it typed icon as string and wrapped it in <Icon> itself, so there was no way to pass an attribute through. It now accepts string | Mithril.Children and renders a passed element as-is — the same contract Button already offers.

What was deliberately left alone

I swept core and the bundled extensions for state-carrying icons. Pairs that use distinct glyphs rather than weights restyle perfectly safely and are untouched — tags' ToggleButton (fa-check-circle vs fa-circle), package-manager's fa-check-circle/fa-circle-down, likes' thumbs (decorative, single-state), and subscriptions' notification/filter icons (single-state labels).

Verification

Live on a forum with fa-duotone fa-light forced: the stars keep their own weights in the DOM (icon fa-regular fa-star alongside icon fa-solid fa-star), so the follow state stays legible while every other icon takes the forced style. Core's JS suite (294 tests) passes, typings check clean in both packages, subscriptions builds.

Worth stating plainly: this is a limitation inherent to the feature, not a defect in it. Any icon whose weight is semantic needs the opt-out, so if reviewers know of others I've missed, they're one prop away from being fixed.

Confirmed

  • Frontend changes: tests are green (yarn jest), typings check passes.

An admin forcing a FontAwesome style asks for uniform icons, but a few
icons use their weight to say something. A filled circle means a user is
online; a solid star means a discussion is followed while a regular one
means it isn't. Restyling those to a single weight either turns the dot
into a thin ring or makes both stars identical, so following and not
following look the same.

Those icons now opt out with noStyleOverride: the online indicator (both
the helper and the copy in UserCard), and the subscription stars in the
menu and the discussion controls.

DetailedDropdownItem accepted only an icon name and wrapped it itself,
leaving no way to pass the flag through, so it now also takes a rendered
icon — matching what Button already allows.

Icons that pair distinct glyphs rather than weights (tags' toggle uses
fa-check-circle against fa-circle) restyle safely and are left alone.
@imorland
imorland requested a review from a team as a code owner July 31, 2026 21:07
@imorland imorland added this to the 2.0.0-rc.6 milestone Jul 31, 2026
@imorland
imorland merged commit ad3e0b9 into 2.x Jul 31, 2026
25 checks passed
@imorland
imorland deleted the im/preserve-semantic-icon-styles branch July 31, 2026 21:23
imorland added a commit that referenced this pull request Aug 2, 2026
…4878)

The discussion list signals unread replies by icon weight alone: a
solid comment for unread against a regular one for read. Forcing a
FontAwesome style restyled both to the same weight, making the two
states indistinguishable.

The unread icon now opts out with noStyleOverride, the same exemption
the online indicator and subscription stars use (#4873). The read-state
icon still follows the forced style, so the contrast survives — the
checkmark shown on hover is an action glyph, not a weight signal, and
keeps following the forced style too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant