Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions gem/lib/ruby_ui/combobox/combobox_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { computePosition, autoUpdate, offset, flip } from "@floating-ui/dom";
// Connects to data-controller="ruby-ui--combobox"
export default class extends Controller {
static values = {
term: String
term: String,
minPopoverWidth: { type: Number, default: 240 }
}

static targets = [
Expand Down Expand Up @@ -186,6 +187,7 @@ export default class extends Controller {
}

updatePopoverWidth() {
this.popoverTarget.style.width = `${this.triggerTarget.offsetWidth}px`
const width = Math.max(this.triggerTarget.offsetWidth, this.minPopoverWidthValue)
this.popoverTarget.style.width = `${width}px`
}
}