Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alt text limit to image dialog #5611

Merged
merged 8 commits into from
Oct 5, 2024
Merged

Add alt text limit to image dialog #5611

merged 8 commits into from
Oct 5, 2024

Conversation

estrattonbailey
Copy link
Member

@estrattonbailey estrattonbailey commented Oct 4, 2024

Updates alt text limit to 2k characters for both images and GIFs + updates the UI with our char counter.

CleanShot 2024-10-04 at 15 51 39@2x
CleanShot 2024-10-04 at 15 51 34@2x
CleanShot 2024-10-04 at 15 55 41@2x
CleanShot 2024-10-04 at 15 56 56@2x
CleanShot 2024-10-04 at 16 01 45@2x

@arcalinea arcalinea temporarily deployed to alt-text-limit - social-app PR #5611 October 4, 2024 20:57 — with Render Destroyed
@arcalinea arcalinea temporarily deployed to alt-text-limit - social-app PR #5611 October 4, 2024 21:02 — with Render Destroyed
Copy link

github-actions bot commented Oct 4, 2024

Old size New size Diff
7.92 MB 7.92 MB -1.23 KB (-0.02%)

}, [onSubmit, altText])
const t = useTheme()
const {_, i18n} = useLingui()
const [altText, setAltText] = useState(altTextRef.current)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn’t read refs during render.

this might be ok but why are we using a ref here? isn’t this a controlled input anyway?

onChange,
Portal,
}: Props): React.ReactNode => {
const altTextRef = React.useRef<string>(image.alt)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, another ref. i’m worrying about proliferation of refs — why are we adding them? they should only be used as escape hatches and i don’t yet see what we’re escaping from. generally adding them for normal data flow needs to have some kind of explanation so we don’t miss this in reviews.

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let’s make sure we have a solid justification for adding refs — easy way to cause bugs if we’re not careful

@haileyok
Copy link
Contributor

haileyok commented Oct 5, 2024

example in gif dialog in 13d195a

@arcalinea arcalinea temporarily deployed to alt-text-limit - social-app PR #5611 October 5, 2024 05:23 — with Render Destroyed
@gaearon gaearon merged commit 76d63f9 into main Oct 5, 2024
6 checks passed
@gaearon gaearon deleted the alt-text-limit branch October 5, 2024 10:58
@surfdude29 surfdude29 mentioned this pull request Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants