[FEAT] Add alt and title attributes for repository avatar images #251

Closed
opened 2023-01-17 07:57:33 +00:00 by polettix · 4 comments

Feature Description

Provide a way to set alt and title attributes associated to the avatar image of a project, and use them.

The alt attribute would help with accessibility. It might be a single-line text input with placeholder Alternative text for screen readers.... When not set explicitly, the alt attribute would be included but left empty (otherwise, from the ongoing spec for HTML: In a conforming document, the absence of the alt attribute indicates that the image is a key part of the content but that a textual replacement for the image was not available when the image was generated.).

The title attribute would help providing additional information, e.g. to set attribution when we use some icon that requires it (think of a CC-BY icon found somewhere). It might be a single-line text input with placeholder Tooltip shown when hovering the mouse on the image.... When not set explicitly, the title attribute would not be included in the tag.

Screenshots

None available:

  • GitHub does not seem to support custom avatars for projects.
  • GitLab supports avatars but does not allow setting any alt/title attribute.
## Feature Description Provide a way to set `alt` and `title` attributes associated to the avatar image of a project, and use them. The `alt` attribute would help with accessibility. It might be a single-line text input with placeholder *Alternative text for screen readers...*. When not set explicitly, the `alt` attribute would be included but left empty (otherwise, from the [ongoing spec for HTML](https://html.spec.whatwg.org/#the-img-element): *In a conforming document, the absence of the `alt` attribute indicates that the image is a key part of the content but that a textual replacement for the image was not available when the image was generated.*). The `title` attribute would help providing additional information, e.g. to set attribution when we use some icon that requires it (think of a CC-BY icon found somewhere). It might be a single-line text input with placeholder *Tooltip shown when hovering the mouse on the image...*. When not set explicitly, the `title` attribute would not be included in the tag. ## Screenshots None available: - GitHub does not seem to support custom avatars for projects. - GitLab supports avatars but does not allow setting any `alt`/`title` attribute.
caesar added the
enhancement/feature
forgejo/accessibility
labels 2023-01-17 11:58:45 +00:00

What is the need behind this proposition and which are the benefits?

When you say avatar image of a project are you refering to the repo avatar or to the org avatar? or both?

What is the need behind this proposition and which are the benefits? When you say *avatar image of a project* are you refering to the repo avatar or to the org avatar? or both?

Sorry, I wrote too much in the issue itself, here are the benefits:

  • The alt attribute would help with accessibility.
  • The title attribute would help providing additional information, e.g. to set attribution when we use some icon that requires it (think of a CC-BY icon found somewhere).

Re repo avatar vs org avatar I'm referring to the repo avatar, because I can understand that putting a different title on org/user avatars might become misleading.

Sorry, I wrote too much in the issue itself, here are the benefits: - The `alt` attribute would help with accessibility. - The `title` attribute would help providing additional information, e.g. to set attribution when we use some icon that requires it (think of a CC-BY icon found somewhere). Re *repo avatar* vs *org avatar* I'm referring to the repo avatar, because I can understand that putting a different `title` on org/user avatars might become misleading.

I agree with the alt attribute, but would not encourage to use the title attribute.
Mobile users wouldn't have a way to access its content. The tooltip behaviour is not guaranteed by the spec.

Relying on the title attribute is currently discouraged as many user agents do not expose the attribute in an accessible manner as required by this specification (e.g., requiring a pointing device such as a mouse to cause a tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or tablet).

I agree with the alt attribute, but would not encourage to use the title attribute. Mobile users wouldn't have a way to access its content. The tooltip behaviour is not guaranteed by the [spec.](https://html.spec.whatwg.org/multipage/dom.html#the-title-attribute) > Relying on the title attribute is currently discouraged as many user agents do not expose the attribute in an accessible manner as required by this specification (e.g., requiring a pointing device such as a mouse to cause a tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or tablet).

Two thoughts:

  1. The repo avatar is placed aside the repo name and provide the same name via its title attr, so its redundant from a screen reader point of view and would be better to remove it from aria tree because is just decorative (as any logo in general). An empty alt do that also, but avoids to show an alternative text in case the image couldn't be downloaded for sight people. In any case, the alternative text should be "repository logo".

  2. Apart from redundance, both elements are inside a container dedicated to the title, so add more information at that level is counterproductive for a screen reader.

Because of above statements, I wouldn't implement this feature.

If anybody have strong arguments in favor of implement these features, please comment for considering.

Two thoughts: 1) The repo avatar is placed aside the repo name and provide the same name via its title attr, so its redundant from a screen reader point of view and would be better to remove it from aria tree because is just decorative (as any logo in general). An empty alt do that also, but avoids to show an alternative text in case the image couldn't be downloaded for sight people. In any case, the alternative text should be "repository logo". 2) Apart from redundance, both elements are inside a container dedicated to the title, so add more information at that level is counterproductive for a screen reader. Because of above statements, I wouldn't implement this feature. If anybody have strong arguments in favor of implement these features, please comment for considering.
fsologureng changed title from [FEAT] Add `alt` and `title` attributes for avatar images to [FEAT] Add `alt` and `title` attributes for repository avatar images 2023-01-18 18:34:40 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: forgejo/forgejo#251
There is no content yet.