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

Several characters in the alt text result in no alt text at all #649

Closed
OddDev opened this issue Feb 26, 2023 · 2 comments · Fixed by #660
Closed

Several characters in the alt text result in no alt text at all #649

OddDev opened this issue Feb 26, 2023 · 2 comments · Fixed by #660

Comments

@OddDev
Copy link

OddDev commented Feb 26, 2023

Describe the bug

Having certain characters in the alt text (as far as I tested, these are :, ", ') makes the alt-text on images not render. I suppose it's a parsing error returning undefined or an empty string.

Steps to reproduce (if necessary)

Steps to reproduce the behavior:

  1. Mak a new post
  2. Add an image [My alt text. That's very "funny".](/path/to/image)
  3. Open the rendered post
  4. The alt text ist missing
  5. Add another image [My alt text. That is very funny.](/path/to/image)
  6. The alt text is there

Expected behavior

The alt text should render regardless of the given input as long as it is compliant with W3 standards.
https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-alt

Application configuration

  • Single mode
  • Database? [write.as]
  • Open registration? [yes]
  • Federation enabled? [yes]

Version or last commit:

@Naln1
Copy link

Naln1 commented Mar 4, 2023

I am also experiencing this behavior. It is very frustrating as someone who cares a lot about accessibility, because it makes writing accurate and concise alt-text very difficult.

@thebaer
Copy link
Member

thebaer commented Mar 7, 2023

Thanks for reporting this.

I've looked into it, and narrowed the issue down to our HTML sanitization policy, which isn't currently allowing HTML entities inside the alt attribute of our rendered HTML. It's a one-line fix -- I'll try to submit that soon.

@thebaer thebaer added this to the 1.0 milestone Mar 7, 2023
thebaer added a commit that referenced this issue Mar 14, 2023
Previously, certain characters weren't allowed, and they would cause the entire
alt attribute to be elided from the rendered page. Since we safely sanitize the
content of this attribute anyway, this is unnecessary, so we now allow all text
entered there.

Fixes #649
@thebaer thebaer closed this as completed Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants