-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Searching for multiple words, separated by a space, is not behaving properly. The width calculation for the internal input is not accounting for any additional width from any whitespace characters, so when a user enters a number of spaces, the text appears to scroll and get hidden to the left.
For example: if I enter the search term 'one two', the 'o' would end up being cut off to the left. This issue is happening on the selectize demo page.
The solution for this is to change the property for white-space from 'nowrap' to 'pre'. This will ensure that the dummy node that is being used to measure the width of the string will render all whitespace without truncating. This can be updated in the following function:
var measureString = function(str, $parent) {
var
position: 'absolute',
top: -99999,
left: -99999,
width: 'auto',
padding: 0,
whiteSpace: 'pre'
}).text(str).appendTo('body');
...