Skip to content

Commit ed74668

Browse files
committed
Fixed bug where inline controls could be "dragged" when selecting an empty area
1 parent 8ac2558 commit ed74668

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

index.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@
187187
<select name="empty-multi-select" size="5" multiple="multiple"></select>
188188
</p>
189189

190+
<p>
191+
Multi-select with few options<br />
192+
<select name="multi-select-few-options" multiple="multiple" size="5">
193+
<option value="1" selected="selected">Item 1</option>
194+
<option value="2">Item 2</option>
195+
<option value="3">Item 3</option>
196+
</select>
197+
</p>
198+
190199
<p>
191200
No multi-select, size = 4<br />
192201
<select name="no-multi-with-size-4" size="4">

jquery.selectBox.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
3-
jQuery selectBox (version 1.0.5)
3+
jQuery selectBox (version 1.0.6)
44
55
A cosmetic, styleable replacement for SELECT elements.
66
@@ -92,6 +92,7 @@
9292
- Clicking no longer toggles selected/unselected in multi-selects; use CTRL/CMD and
9393
SHIFT like in normal browser controls
9494
- Fixed bug where inline controls would not receive focus unless tabbed into
95+
v1.0.6 (2011-04-29) - Fixed bug where inline controls could be "dragged" when selecting an empty area
9596
9697
9798
Known Issues:
@@ -169,6 +170,10 @@ if(jQuery) (function($) {
169170
.bind('keypress.selectBox', function(event) {
170171
handleKeyPress(select, event);
171172
})
173+
.bind('mousedown.selectBox', function(event) {
174+
if( $(event.target).is('A.selectBox-inline') ) event.preventDefault();
175+
if( !control.hasClass('selectBox-focus') ) control.focus();
176+
})
172177
.insertAfter(select);
173178

174179
// Auto-height based on size attribute

0 commit comments

Comments
 (0)