Improvement (combobox): respect minimum popover width when trigger is narrow#397
Open
karinevieira wants to merge 1 commit into
Open
Improvement (combobox): respect minimum popover width when trigger is narrow#397karinevieira wants to merge 1 commit into
karinevieira wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a
RubyUI::Comboboxtrigger 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 theComboboxSearchInputplaceholder.updatePopoverWidthcurrently setspopover.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
minPopoverWidthStimulus value (default240) and applies it as a floor insideupdatePopoverWidthThe change is monotonic: it only expands popovers that would otherwise be narrower than the floor. Triggers wider than 240px are unaffected (no regression).
resize@windowalready callsupdatePopoverWidth, 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:
Summary by cubic
Prevents
RubyUI::Comboboxpopovers from shrinking below a sensible width when the trigger is narrow, avoiding cut-off placeholders and cramped content.minPopoverWidthStimulus value (default 240) and apply it as a floor inupdatePopoverWidth.max(trigger width, minPopoverWidth)and still updates on window resize.ruby-ui--combobox-min-popover-width-value.Written for commit cf1310d. Summary will update on new commits. Review in cubic