Skip to content
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
1 change: 1 addition & 0 deletions legacy/docs/content/widgets/configs/TextArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default {
showClear: false,
hideClear: false,
inputType: false,
trim: false,
reactOn: {
type: 'string',
description: <cx><Md>
Expand Down
8 changes: 7 additions & 1 deletion packages/cx/src/widgets/form/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ import { autoFocus } from "../autoFocus";
import { getActiveElement } from "../../util/getActiveElement";
import { NumberProp } from "../../ui/Prop";

export interface TextAreaConfig extends TextFieldConfig {
/**
* `trim` is intentionally omitted: `TextArea` renders its own input which commits the raw value,
* so leading and trailing whitespace is always preserved.
*/
export interface TextAreaConfig extends Omit<TextFieldConfig, "trim"> {
/** Specifies the number of visible lines. */
rows?: NumberProp;

Expand Down Expand Up @@ -65,6 +69,8 @@ export class TextArea extends TextField<TextAreaConfig> {

TextArea.prototype.baseClass = "textarea";
TextArea.prototype.reactOn = "blur";
// `trim` is not supported by TextArea, so a global `TextField.prototype.trim = true` must not leak into it.
TextArea.prototype.trim = false;
TextArea.prototype.suppressErrorsUntilVisited = true;

interface InputProps {
Expand Down
Loading