Skip to content

Commit

Permalink
Merge pull request #498 from bindoon/fix-select
Browse files Browse the repository at this point in the history
fix(Select): use mouse to select text. Close #469
  • Loading branch information
youluna authored Mar 26, 2019
2 parents f7b7409 + d474b7a commit a59fe24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/select/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ const Option = Select.Option;
const onChange = function (value) {
console.log(value);
};
const onBlur = function (e) {
console.log(/onblur/,e);
};

const onToggleHighlightItem = function (item, type) {
console.log(item, type);
};

ReactDOM.render(<Select id="basic-demo" onChange={onChange} onToggleHighlightItem={onToggleHighlightItem} defaultValue="jack" aria-label="name is" showSearch hasClear>
ReactDOM.render(<Select id="basic-demo" onChange={onChange} onBlur={onBlur} onToggleHighlightItem={onToggleHighlightItem} defaultValue="jack" aria-label="name is" showSearch hasClear>
<Option value="jack">Jack</Option>
<Option value="frank">Frank</Option>
<Option value="hugo">Hugo</Option>
Expand Down
5 changes: 4 additions & 1 deletion src/select/select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,10 @@ class Select extends Base {
* @returns
*/
handleWrapClick = e => {
e.preventDefault();
// ignore click on input to choose text
if (e.target.nodeName !== 'INPUT') {
e.preventDefault();
}
this.focusInput();
};

Expand Down

0 comments on commit a59fe24

Please sign in to comment.