Skip to content

Commit 0c66c63

Browse files
committed
Fix reorder buttons staying active once pressed.
1 parent 2128784 commit 0c66c63

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/components/fields/ArrayField.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ class ArrayField extends Component {
108108
onReorderClick = (index, newIndex) => {
109109
return (event) => {
110110
event.preventDefault();
111+
event.target.blur();
111112
const {items} = this.state;
112113
this.asyncSetState({
113114
items: items.map((item, i) => {
@@ -330,6 +331,7 @@ class ArrayField extends Component {
330331
const {SchemaField} = this.props.registry.fields;
331332
const {disabled, readonly} = this.props;
332333
const hasToolbar = removable || canMoveUp || canMoveDown;
334+
const btnStyle = {flex: 1, paddingLeft: 6, paddingRight: 6, fontWeight: "bold"};
333335

334336
return (
335337
<div key={index} className="array-item">
@@ -352,24 +354,24 @@ class ArrayField extends Component {
352354
<div className="btn-group" style={{display: "flex"}}>
353355
{canMoveUp || canMoveDown ?
354356
<button type="button" className="btn btn-default array-item-move-up"
355-
style={{flex: 1, paddingLeft: 6, paddingRight: 6}}
357+
style={btnStyle}
356358
tabIndex="-1"
357359
disabled={disabled || readonly || !canMoveUp}
358360
onClick={this.onReorderClick(index, index - 1)}></button>
359361
: null}
360362
{canMoveUp || canMoveDown ?
361363
<button type="button" className="btn btn-default array-item-move-down"
362-
style={{flex: 1, paddingLeft: 6, paddingRight: 6}}
364+
style={btnStyle}
363365
tabIndex="-1"
364366
disabled={disabled || readonly || !canMoveDown}
365367
onClick={this.onReorderClick(index, index + 1)}></button>
366368
: null}
367369
{removable ?
368370
<button type="button" className="btn btn-danger array-item-remove"
369-
style={{flex: 1, paddingLeft: 6, paddingRight: 6}}
371+
style={btnStyle}
370372
tabIndex="-1"
371373
disabled={disabled || readonly}
372-
onClick={this.onDropIndexClick(index)}></button>
374+
onClick={this.onDropIndexClick(index)}></button>
373375
: null}
374376
</div>
375377
</div>

0 commit comments

Comments
 (0)