Skip to content

Commit 864ecf2

Browse files
authored
Expose props for disabling auto-correct, auto-complete, auto-capitalize (facebookarchive#1035)
Wanted: manual testing of this PR. There is some really weird behavior in Android 5.0 when auto-correct happens. More details here; facebookarchive#1010 Setting 'spellCheck' to 'false' didn't seem to be enough to stop this. My quick fix for now is to expose more properties on Draft for controlling autocorrect. This could also be useful to people in general, since there are often complaints about autocorrect on mobile web. Long term we will be addressing the root causes of the bugs with mobile web, but this seems like a useful change regardless. We did some testing with mobile web using these props. Ideally I'd like to get testing done of each prop in each supported browser, and document the effects. If anyone can help verify different behaviors please comment here, otherwise I'll get to it soon. Note that we'll update the documentation once this change is actually included in a released version of Draft.js.
1 parent 47c26cc commit 864ecf2

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/component/base/DraftEditor.react.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ class DraftEditor extends React.Component {
243243
aria-haspopup={readOnly ? null : this.props.ariaHasPopup}
244244
aria-label={this.props.ariaLabel}
245245
aria-owns={readOnly ? null : this.props.ariaOwneeID}
246+
autoCapitalize={this.props.autoCapitalize}
247+
autoComplete={this.props.autoComplete}
248+
autoCorrect={this.props.autoCorrect}
246249
className={cx('public/DraftEditor/content')}
247250
contentEditable={!readOnly}
248251
data-testid={this.props.webDriverTestID}

src/component/base/DraftEditorProps.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ export type DraftEditorProps = {
8080

8181
tabIndex?: number,
8282

83+
// exposed especially to help improve mobile web behaviors
84+
autoCapitalize?: string,
85+
autoComplete?: string,
86+
autoCorrect?: string,
87+
8388
ariaActiveDescendantID?: string,
8489
ariaAutoComplete?: string,
8590
ariaDescribedBy?: string,

0 commit comments

Comments
 (0)