Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TextField][InputLabel] Remove pointer-events: none property #30493

Merged
merged 4 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ TextField.propTypes = {
classes: PropTypes.object.isRequired,
/**
* Props applied to the [`InputLabel`](/api/input-label/) element.
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
*/
InputLabelProps: PropTypes.object,
/**
Expand Down
2 changes: 1 addition & 1 deletion docs/translations/api-docs/text-field/text-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"fullWidth": "If <code>true</code>, the input will take up the full width of its container.",
"helperText": "The helper text content.",
"id": "The id of the <code>input</code> element. Use this prop to make <code>label</code> and <code>helperText</code> accessible for screen readers.",
"InputLabelProps": "Props applied to the <a href=\"/api/input-label/\"><code>InputLabel</code></a> element.",
"InputLabelProps": "Props applied to the <a href=\"/api/input-label/\"><code>InputLabel</code></a> element. Pointer events like <code>onClick</code> are enabled if and only if <code>shrink</code> is <code>true</code>.",
"inputProps": "<a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes\">Attributes</a> applied to the <code>input</code> element.",
"InputProps": "Props applied to the Input element. It will be a <a href=\"/api/filled-input/\"><code>FilledInput</code></a>, <a href=\"/api/outlined-input/\"><code>OutlinedInput</code></a> or <a href=\"/api/input/\"><code>Input</code></a> component depending on the <code>variant</code> prop value.",
"inputRef": "Pass a ref to the <code>input</code> element.",
Expand Down
4 changes: 4 additions & 0 deletions packages/mui-material/src/InputLabel/InputLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ const InputLabelRoot = styled(FormLabel, {
transform: 'translate(12px, 13px) scale(1)',
}),
...(ownerState.shrink && {
userSelect: 'none',
pointerEvents: 'auto',
transform: 'translate(12px, 7px) scale(0.75)',
maxWidth: 'calc(133% - 24px)',
...(ownerState.size === 'small' && {
Expand All @@ -105,6 +107,8 @@ const InputLabelRoot = styled(FormLabel, {
transform: 'translate(14px, 9px) scale(1)',
}),
...(ownerState.shrink && {
userSelect: 'none',
pointerEvents: 'auto',
maxWidth: 'calc(133% - 24px)',
transform: 'translate(14px, -9px) scale(0.75)',
}),
Expand Down
1 change: 1 addition & 0 deletions packages/mui-material/src/TextField/TextField.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export interface BaseTextFieldProps
id?: string;
/**
* Props applied to the [`InputLabel`](/api/input-label/) element.
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
*/
InputLabelProps?: Partial<InputLabelProps>;
/**
Expand Down
1 change: 1 addition & 0 deletions packages/mui-material/src/TextField/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ TextField.propTypes /* remove-proptypes */ = {
id: PropTypes.string,
/**
* Props applied to the [`InputLabel`](/api/input-label/) element.
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
*/
InputLabelProps: PropTypes.object,
/**
Expand Down