Profile editing: Re-adds the character counter with the new limit (#38400)

This commit is contained in:
Echo
2026-03-25 16:31:58 +01:00
committed by GitHub
parent 2a4b205c75
commit 61e0ec8844

View File

@@ -3,6 +3,7 @@ import { useCallback, useState } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { CharacterCounter } from '@/mastodon/components/character_counter';
import { Details } from '@/mastodon/components/details'; import { Details } from '@/mastodon/components/details';
import { TextAreaField } from '@/mastodon/components/form_fields'; import { TextAreaField } from '@/mastodon/components/form_fields';
import { LoadingIndicator } from '@/mastodon/components/loading_indicator'; import { LoadingIndicator } from '@/mastodon/components/loading_indicator';
@@ -84,7 +85,12 @@ export const ImageAltTextField: FC<{
const altLimit = useAppSelector( const altLimit = useAppSelector(
(state) => (state) =>
state.server.getIn( state.server.getIn(
['server', 'configuration', 'media_attachments', 'description_limit'], [
'server',
'configuration',
'accounts',
'max_header_description_length',
],
150, 150,
) as number, ) as number,
); );
@@ -100,23 +106,26 @@ export const ImageAltTextField: FC<{
<> <>
<img src={imageSrc} alt='' className={classes.altImage} /> <img src={imageSrc} alt='' className={classes.altImage} />
<TextAreaField <div>
label={ <TextAreaField
<FormattedMessage label={
id='account_edit.image_alt_modal.text_label' <FormattedMessage
defaultMessage='Alt text' id='account_edit.image_alt_modal.text_label'
/> defaultMessage='Alt text'
} />
hint={ }
<FormattedMessage hint={
id='account_edit.image_alt_modal.text_hint' <FormattedMessage
defaultMessage='Alt text helps screen reader users to understand your content.' id='account_edit.image_alt_modal.text_hint'
/> defaultMessage='Alt text helps screen reader users to understand your content.'
} />
onChange={handleChange} }
value={altText} onChange={handleChange}
maxLength={altLimit} value={altText}
/> maxLength={altLimit}
/>
<CharacterCounter currentString={altText} maxLength={altLimit} />
</div>
{!hideTip && ( {!hideTip && (
<Details <Details