Fix disabling spellcheck with `<Input>`

This commit is contained in:
Evan Hahn 2022-01-13 17:27:14 -06:00 committed by GitHub
parent 393b740fe6
commit f9faf9b759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2021 Signal Messenger, LLC
// Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useState } from 'react';
@ -18,6 +18,7 @@ const stories = storiesOf('Components/Input', module);
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
disabled: Boolean(overrideProps.disabled),
disableSpellcheck: overrideProps.disableSpellcheck,
expandable: Boolean(overrideProps.expandable),
hasClearButton: Boolean(overrideProps.hasClearButton),
i18n,
@ -92,3 +93,11 @@ stories.add('disabled', () => (
})}
/>
));
stories.add('spellcheck disabled', () => (
<Controller
{...createProps({
disableSpellcheck: true,
})}
/>
));

View File

@ -1,4 +1,4 @@
// Copyright 2021 Signal Messenger, LLC
// Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ClipboardEvent, ReactNode } from 'react';
@ -203,7 +203,7 @@ export const Input = forwardRef<
isLarge && getClassName('__input--large')
),
disabled: Boolean(disabled),
spellcheck: disableSpellcheck ? 'false' : 'true',
spellCheck: !disableSpellcheck,
onChange: handleChange,
onKeyDown: handleKeyDown,
onPaste: handlePaste,