Improvement (combobox): respect minimum popover width when trigger is narrow
Description
When a RubyUI::Combobox trigger is narrower than the popover's natural content (e.g. a short trigger label like "Status"), the popover shrinks to match the trigger width and cuts off the ComboboxSearchInput placeholder.
updatePopoverWidth currently sets popover.style.width = trigger.offsetWidth + "px" unconditionally, coupling the popover's width to the trigger's width 1:1. The popover content has its own natural minimum that's independent of the trigger.
This PR introduces a minPopoverWidth Stimulus value (default 240) and applies it as a floor inside updatePopoverWidth
The change is monotonic: it only expands popovers that would otherwise be narrower than the floor. Triggers wider than 240px are unaffected (no regression). resize@window already calls updatePopoverWidth, so the floor holds after viewport changes without any new event listeners.
Consumers can override the floor per-instance via the standard Stimulus values API:
render RubyUI::Combobox.new(data: { "ruby-ui--combobox-min-popover-width-value": 320 })
...
end
| Before | After |
|---|
Summary by cubic
Prevents RubyUI::Combobox popovers from shrinking below a sensible width when the trigger is narrow, avoiding cut-off placeholders and cramped content.
- Bug Fixes
- Added
minPopoverWidthStimulus value (default 240) and apply it as a floor inupdatePopoverWidth. - Popover width is now
max(trigger width, minPopoverWidth)and still updates on window resize. - Per-instance overrides supported via
ruby-ui--combobox-min-popover-width-value.
- Added