Skip to content

Conversation

karakum
Copy link

@karakum karakum commented May 23, 2019

This pull request includes a

  • Bug fix
  • New feature
  • Translation

This PR fix #5517

@karakum karakum changed the title #5517 fix wrong width calculation Fix wrong search input width calculation when empty selection May 23, 2019
@kevin-brown
Copy link
Member

This makes sense as a change (based on the details in #5517). It would be solid if we could also get a test which covers this (these might be a good starting example), just so we don't run into this again in the future.

kevin-brown pushed a commit that referenced this pull request Jul 30, 2019
This fixes a bug with the search box where, when it had a placeholder,
it would expand the width of the selection container because it was
too large. This bug was specifically caused by the search box not
factoring in the padding surrounding it when caclualting the width
it needed to be, which resulted in the search box extending
outside of the selection container. This bug was easy to notice if
your Select2 was set to have 100% width and if the container it was
held within was not a block element.

This fixes the bug by switching to using `width()` for calculating
the search width instead of using `innerWidth()`, which ignored the
surrounding padding.

Fixes #5517
Closes #5518
kevin-brown added a commit that referenced this pull request Jul 30, 2019
This fixes a bug with the search box where, when it had a placeholder,
it would expand the width of the selection container because it was
too large. This bug was specifically caused by the search box not
factoring in the padding surrounding it when caclualting the width
it needed to be, which resulted in the search box extending
outside of the selection container. This bug was easy to notice if
your Select2 was set to have 100% width and if the container it was
held within was not a block element.

This fixes the bug by switching to using `width()` for calculating
the search width instead of using `innerWidth()`, which ignored the
surrounding padding.

Fixes #5517
Closes #5518
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.

Wrong width calculation of empty search input
2 participants