Remove alt attribute in avatar images

These images are always displayed next to a username, meaning people
using screen readers were hearing the same username twice in a row.

Even though we're about to replace the initialjs gem, we're making this
change in case so we've got one more test and we can check everything
keeps working after replacing the gem.
This commit is contained in:
Javi Martín
2024-03-29 20:27:22 +01:00
parent f1516b52ba
commit 9beb1608c4
2 changed files with 11 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ class Shared::AvatarComponent < ApplicationComponent
private private
def default_options def default_options
{ background_color: colors[seed % colors.size] } { background_color: colors[seed % colors.size], alt: "" }
end end
def options def options

View File

@@ -0,0 +1,10 @@
require "rails_helper"
describe Shared::AvatarComponent do
it "does not contain redundant text already present around it" do
render_inline Shared::AvatarComponent.new(double(id: 1, name: "Johnny"))
expect(page).to have_css "img", count: 1
expect(page).to have_css "img[alt='']"
end
end