Fix disabling spellcheck with <Input>
This commit is contained in:
parent
393b740fe6
commit
f9faf9b759
2 changed files with 12 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
@ -18,6 +18,7 @@ const stories = storiesOf('Components/Input', module);
|
||||||
|
|
||||||
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
|
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
|
||||||
disabled: Boolean(overrideProps.disabled),
|
disabled: Boolean(overrideProps.disabled),
|
||||||
|
disableSpellcheck: overrideProps.disableSpellcheck,
|
||||||
expandable: Boolean(overrideProps.expandable),
|
expandable: Boolean(overrideProps.expandable),
|
||||||
hasClearButton: Boolean(overrideProps.hasClearButton),
|
hasClearButton: Boolean(overrideProps.hasClearButton),
|
||||||
i18n,
|
i18n,
|
||||||
|
@ -92,3 +93,11 @@ stories.add('disabled', () => (
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
||||||
|
stories.add('spellcheck disabled', () => (
|
||||||
|
<Controller
|
||||||
|
{...createProps({
|
||||||
|
disableSpellcheck: true,
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { ClipboardEvent, ReactNode } from 'react';
|
import type { ClipboardEvent, ReactNode } from 'react';
|
||||||
|
@ -203,7 +203,7 @@ export const Input = forwardRef<
|
||||||
isLarge && getClassName('__input--large')
|
isLarge && getClassName('__input--large')
|
||||||
),
|
),
|
||||||
disabled: Boolean(disabled),
|
disabled: Boolean(disabled),
|
||||||
spellcheck: disableSpellcheck ? 'false' : 'true',
|
spellCheck: !disableSpellcheck,
|
||||||
onChange: handleChange,
|
onChange: handleChange,
|
||||||
onKeyDown: handleKeyDown,
|
onKeyDown: handleKeyDown,
|
||||||
onPaste: handlePaste,
|
onPaste: handlePaste,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue