Skip to content

Conversation

DavideIadeluca
Copy link
Contributor

@DavideIadeluca DavideIadeluca commented Oct 3, 2025

2.x equivalent to #4246

Fixes #0000

Changes proposed in this pull request:

  • Removes the unnecessary loading="lazy" attribute for avatars with no avatarUrl
  • Sets the aria role to img and adds an aria-label

Reviewers should focus on:

Screenshot
Before this Change:

<span class="Avatar Post-avatar" loading="lazy" style="--avatar-bg: #afa0e5;">M</span>

After this change:

<span class="Avatar Post-avatar" role="img" aria-label="moderator" style="--avatar-bg: #afa0e5;">M</span>

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)

@DavideIadeluca DavideIadeluca marked this pull request as ready for review October 3, 2025 11:42
@DavideIadeluca DavideIadeluca requested a review from a team as a code owner October 3, 2025 11:42
@imorland imorland added the type/accessibility Issues relating to accessibility (keyboard navigation, screenreaders, text contrast, etc.) label Oct 3, 2025
@imorland imorland changed the title chore(core): improve a11y of avatar with no avatarUrl [2.x] chore(core): improve a11y of avatar with no avatarUrl Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/accessibility Issues relating to accessibility (keyboard navigation, screenreaders, text contrast, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants