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:
@@ -10,7 +10,7 @@ class Shared::AvatarComponent < ApplicationComponent
|
||||
private
|
||||
|
||||
def default_options
|
||||
{ background_color: colors[seed % colors.size] }
|
||||
{ background_color: colors[seed % colors.size], alt: "" }
|
||||
end
|
||||
|
||||
def options
|
||||
|
||||
10
spec/components/shared/avatar_component_spec.rb
Normal file
10
spec/components/shared/avatar_component_spec.rb
Normal 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
|
||||
Reference in New Issue
Block a user