Skip to content

[2.x] fix: let gambit suggestions wrap instead of running off the dropdown - #4888

Merged
imorland merged 1 commit into
2.xfrom
im/gambit-value-overflow
Aug 3, 2026
Merged

[2.x] fix: let gambit suggestions wrap instead of running off the dropdown#4888
imorland merged 1 commit into
2.xfrom
im/gambit-value-overflow

Conversation

@imorland

@imorland imorland commented Aug 3, 2026

Copy link
Copy Markdown
Member

The is: row in the search modal was cut off mid-word:

is: hidden, unread, following, ignoring, sticky, locked, private, blog, trending, bo…

.Dropdown-menu > li > a, > button, > span sets white-space: nowrap, overflow: hidden and text-overflow: ellipsis. That is right for a menu of commands, but the gambit rows document the query syntax, and the value against is: is every boolean gambit joined into one string — it grows with each extension that registers one, so no width makes truncation useful. Any forum with a few extensions installed hits it.

What changed

The reset is declared inside the block it overrides, next to the other &. modifiers. That placement is the substance of the fix rather than tidiness: the generic selector matches on two classes and two elements, so the same declarations written against .GambitsAutocomplete-gambit alone lose the cascade and do nothing at all. Compiled output confirms the override resolves to .Dropdown-menu > li > span.GambitsAutocomplete-gambit, winning on specificity and source order.

Wrapping then needs the flex containers to permit it:

  • min-width: 0 on the button — a flex item will not shrink below its text’s intrinsic width without it, so the row pushed out of the panel rather than wrapping inside it
  • flex-wrap: wrap so the key and value can occupy separate lines
  • flex-shrink: 0 on the key, which is the label the row is identified by and keeps its line
  • overflow-wrap: break-word on the value, so a single over-long token breaks rather than escaping the panel
  • alignment moves from center to flex-start / baseline, because a row can now be taller than one line and the add/negate buttons should sit on the first line rather than against the middle of a wrapped block

Notes

Only .GambitsAutocomplete-gambit is affected; every other dropdown item keeps the single-line ellipsis behaviour.

Surfaced while looking at a raw translation key in that list (FriendsOfFlarum/gamification#167), but the clipping is independent of it and predates it — the shortened label just moves the cutoff rather than removing it.

Verified by compiling less/common/Dropdown.less with less.php and reading the emitted CSS, and in the browser.

Dropdown items are laid out as single lines and ellipsised, which is right
for a menu of commands but not for the gambit rows in the search modal.
Those rows document the query syntax, and the value shown against `is:` is
every boolean gambit joined into one string — it grows with each extension
that registers one, so there is no width at which truncating it stays
useful. On a forum with a handful of extensions installed the row was
already being cut off mid-word.

The row now wraps. `white-space`, `overflow` and `text-overflow` are reset
alongside the defaults they override so the two are read together; the
generic rule matches on two classes and two elements, so a reset declared
further down the file on the class alone would have lost the cascade and
silently done nothing.

Wrapping then needs the flex containers to allow it: a flex item will not
shrink below the intrinsic width of its text without `min-width: 0`, and
the key and value need `flex-wrap` to move onto separate lines. The key
keeps its own line, since it is the label the row is identified by. Now
that a row can be taller than one line, the alignment shifts from centre
to the first line so the key, its value and the add/negate buttons all sit
on the same baseline rather than floating against the middle of a wrapped
block.
@imorland
imorland requested a review from a team as a code owner August 3, 2026 19:44
@imorland imorland changed the title fix: let gambit suggestions wrap instead of running off the dropdown [2.x] fix: let gambit suggestions wrap instead of running off the dropdown Aug 3, 2026
@imorland imorland added this to the 2.0.0-rc.6 milestone Aug 3, 2026
@imorland
imorland merged commit ae31d6a into 2.x Aug 3, 2026
24 checks passed
@imorland
imorland deleted the im/gambit-value-overflow branch August 3, 2026 19:52
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