AutosuggestInput/AutosuggestTextarea: actually, just remove RTL checking. The browser should handle it

This commit is contained in:
Alex Gleason 2022-12-23 11:38:42 -06:00
parent 95f7761fb4
commit ee9908aab2
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 0 additions and 17 deletions

View file

@ -8,7 +8,6 @@ import AutosuggestEmoji, { Emoji } from 'soapbox/components/autosuggest-emoji';
import Icon from 'soapbox/components/icon'; import Icon from 'soapbox/components/icon';
import { Input } from 'soapbox/components/ui'; import { Input } from 'soapbox/components/ui';
import AutosuggestAccount from 'soapbox/features/compose/components/autosuggest-account'; import AutosuggestAccount from 'soapbox/features/compose/components/autosuggest-account';
import { isRtl } from 'soapbox/rtl';
import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions'; import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions';
import type { Menu, MenuItem } from 'soapbox/components/dropdown-menu'; import type { Menu, MenuItem } from 'soapbox/components/dropdown-menu';
@ -264,15 +263,8 @@ export default class AutosuggestInput extends ImmutablePureComponent<IAutosugges
render() { render() {
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, className, id, maxLength, menu, theme } = this.props; const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, className, id, maxLength, menu, theme } = this.props;
const { suggestionsHidden } = this.state; const { suggestionsHidden } = this.state;
const style: React.CSSProperties = { direction: 'ltr' };
const visible = !suggestionsHidden && (!suggestions.isEmpty() || (menu && value)); const visible = !suggestionsHidden && (!suggestions.isEmpty() || (menu && value));
// TODO: convert to functional component and use `useLocale()` hook instead of checking placeholder text.
if (isRtl(value) || (placeholder && isRtl(placeholder))) {
style.direction = 'rtl';
}
return [ return [
<div key='input' className='relative w-full'> <div key='input' className='relative w-full'>
<label className='sr-only'>{placeholder}</label> <label className='sr-only'>{placeholder}</label>
@ -291,7 +283,6 @@ export default class AutosuggestInput extends ImmutablePureComponent<IAutosugges
onKeyUp={onKeyUp} onKeyUp={onKeyUp}
onFocus={this.onFocus} onFocus={this.onFocus}
onBlur={this.onBlur} onBlur={this.onBlur}
style={style}
aria-autocomplete='list' aria-autocomplete='list'
id={id} id={id}
maxLength={maxLength} maxLength={maxLength}

View file

@ -7,7 +7,6 @@ import Textarea from 'react-textarea-autosize';
import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions'; import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions';
import AutosuggestAccount from '../features/compose/components/autosuggest-account'; import AutosuggestAccount from '../features/compose/components/autosuggest-account';
import { isRtl } from '../rtl';
import AutosuggestEmoji, { Emoji } from './autosuggest-emoji'; import AutosuggestEmoji, { Emoji } from './autosuggest-emoji';
@ -227,12 +226,6 @@ class AutosuggestTextarea extends ImmutablePureComponent<IAutosuggesteTextarea>
render() { render() {
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children, condensed, id } = this.props; const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children, condensed, id } = this.props;
const { suggestionsHidden } = this.state; const { suggestionsHidden } = this.state;
const style = { direction: 'ltr', minRows: 10 };
// TODO: convert to functional component and use `useLocale()` hook instead of checking placeholder text.
if (isRtl(value) || (placeholder && isRtl(placeholder))) {
style.direction = 'rtl';
}
return [ return [
<div key='textarea'> <div key='textarea'>
@ -257,7 +250,6 @@ class AutosuggestTextarea extends ImmutablePureComponent<IAutosuggesteTextarea>
onFocus={this.onFocus} onFocus={this.onFocus}
onBlur={this.onBlur} onBlur={this.onBlur}
onPaste={this.onPaste} onPaste={this.onPaste}
style={style as any}
aria-autocomplete='list' aria-autocomplete='list'
/> />
</label> </label>