Skip to content

Commit 9950950

Browse files
authored
fix(Input): pass all handlers to the html input (#886)
1 parent e92c8cc commit 9950950

File tree

2 files changed

+75
-24
lines changed

2 files changed

+75
-24
lines changed

src/elements/Input/Input.js

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,37 @@ import Icon from '../../elements/Icon'
1717
import Label from '../../elements/Label'
1818

1919
export const htmlInputPropNames = [
20-
// React
21-
'selected',
22-
'defaultValue',
23-
'defaultChecked',
24-
25-
// Limited HTML props
26-
'autoComplete',
27-
'autoFocus',
28-
'checked',
29-
// 'disabled', do not pass (duplicates SUI CSS opacity rule)
30-
'form',
31-
'max',
32-
'maxLength',
33-
'min',
34-
'name',
35-
'onChange',
36-
'pattern',
37-
'placeholder',
38-
'readOnly',
39-
'required',
40-
'step',
41-
'type',
42-
'value',
20+
// REACT
21+
'selected', 'defaultValue', 'defaultChecked',
22+
23+
// LIMITED HTML PROPS
24+
'autoComplete', 'autoFocus', 'checked', 'form', 'max', 'maxLength', 'min',
25+
'name', 'pattern', 'placeholder', 'readOnly', 'required', 'step', 'type', 'value',
26+
27+
// Heads Up!
28+
// Do not pass disabled, it duplicates the SUI CSS opacity rule.
29+
// 'disabled',
30+
31+
// EVENTS
32+
// keyboard
33+
'onKeyDown', 'onKeyPress', 'onKeyUp',
34+
35+
// focus
36+
'onFocus', 'onBlur',
37+
38+
// form
39+
'onChange', 'onInput',
40+
41+
// mouse
42+
'onClick', 'onContextMenu',
43+
'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop',
44+
'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp',
45+
46+
// selection
47+
'onSelect',
48+
49+
// touch
50+
'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart',
4351
]
4452

4553
const _meta = {

test/specs/elements/Input/Input-test.js

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,50 @@ import Input, { htmlInputPropNames } from 'src/elements/Input/Input'
77
import * as common from 'test/specs/commonTests'
88

99
describe('Input', () => {
10-
common.isConformant(Input, { eventTargets: { onChange: 'input' } })
10+
common.isConformant(Input, {
11+
eventTargets: {
12+
// keyboard
13+
onKeyDown: 'input',
14+
onKeyPress: 'input',
15+
onKeyUp: 'input',
16+
17+
// focus
18+
onFocus: 'input',
19+
onBlur: 'input',
20+
21+
// form
22+
onChange: 'input',
23+
onInput: 'input',
24+
25+
// mouse
26+
onClick: 'input',
27+
onContextMenu: 'input',
28+
onDrag: 'input',
29+
onDragEnd: 'input',
30+
onDragEnter: 'input',
31+
onDragExit: 'input',
32+
onDragLeave: 'input',
33+
onDragOver: 'input',
34+
onDragStart: 'input',
35+
onDrop: 'input',
36+
onMouseDown: 'input',
37+
onMouseEnter: 'input',
38+
onMouseLeave: 'input',
39+
onMouseMove: 'input',
40+
onMouseOut: 'input',
41+
onMouseOver: 'input',
42+
onMouseUp: 'input',
43+
44+
// selection
45+
onSelect: 'input',
46+
47+
// touch
48+
onTouchCancel: 'input',
49+
onTouchEnd: 'input',
50+
onTouchMove: 'input',
51+
onTouchStart: 'input',
52+
},
53+
})
1154
common.hasUIClassName(Input)
1255

1356
common.implementsLabelProp(Input, {

0 commit comments

Comments
 (0)