Skip to content

Wrong width calculation of empty search input #5517

@karakum

Description

@karakum

Now search input width calculate as parent innerWidth():

    if (this.$search.attr('placeholder') !== '') {
      width = this.$selection.find('.select2-selection__rendered').innerWidth();

This is wrong, because ul.select2-selection__rendered has left&right padding.
So search input makes select2 container grows up.
To fix that it just need to calculate width by width(), that not count paddings.

JS fiddle: https://jsfiddle.net/karakum/2o6xzupe/

Empty select:
изображение

Not empty:
изображение

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions