Skip to content

Commit

Permalink
[Select] Better support Preact (#18027)
Browse files Browse the repository at this point in the history
  • Loading branch information
glromeo authored and oliviertassinari committed Oct 27, 2019
1 parent 0d5af7d commit c1007ed
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/material-ui/src/Select/SelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
}

event.persist();
event.target = { value: newValue, name };
// Preact support, target is read only property on a native event.
Object.defineProperty(event, 'target', { writable: true, value: { value: newValue, name } });
onChange(event, child);
}
};
Expand Down Expand Up @@ -156,7 +157,8 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
// if open event.stopImmediatePropagation
if (!open && onBlur) {
event.persist();
event.target = { value, name };
// Preact support, target is read only property on a native event.
Object.defineProperty(event, 'target', { writable: true, value: { value, name } });
onBlur(event);
}
};
Expand Down

0 comments on commit c1007ed

Please sign in to comment.