Fix avatar edition accessibility

This commit is contained in:
Chocobozzz 2024-09-27 11:23:07 +02:00
parent 0706d565bc
commit c55c94c844
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 29 additions and 22 deletions

View File

@ -2,22 +2,17 @@
<div class="position-relative me-3">
<my-actor-avatar [actor]="actor" [actorType]="actorType" [previewImage]="preview" size="100"></my-actor-avatar>
<div *ngIf="editable && !hasAvatar()" class="actor-img-edit-button button-focus-within" [ngbTooltip]="avatarFormat" placement="right" container="body">
<my-global-icon iconName="upload"></my-global-icon>
<label class="visually-hidden" for="avatarfile" i18n>Upload a new avatar</label>
<input #avatarfileInput type="file" name="avatarfile" id="avatarfile" [accept]="avatarExtensions" (change)="onAvatarChange(avatarfileInput)"/>
</div>
<div *ngIf="editable && hasAvatar()" ngbDropdown placement="right">
<button type="button" class="actor-img-edit-button" ngbDropdownToggle>
@if (editable) {
@if (hasAvatar()) {
<div ngbDropdown placement="right">
<button type="button" class="actor-img-edit-button" i18n-arialLabel aria-label="Change your avatar" ngbDropdownToggle>
<my-global-icon iconName="edit"></my-global-icon>
<label class="visually-hidden" for="avatarMenu" i18n>Change your avatar</label>
</button>
<div ngbDropdownMenu>
<div class="dropdown-item dropdown-file button-focus-within" [ngbTooltip]="avatarFormat">
<my-global-icon iconName="upload"></my-global-icon>
<span for="avatarfile" i18n>Upload a new avatar</span>
<label for="avatarfile" i18n>Upload a new avatar</label>
<input #avatarfileInput type="file" name="avatarfile" id="avatarfile" [accept]="avatarExtensions" (change)="onAvatarChange(avatarfileInput)"/>
</div>
@ -26,8 +21,15 @@
<span i18n>Remove avatar</span>
</button>
</div>
</div>
} @else {
<div class="actor-img-edit-button button-focus-within" [ngbTooltip]="avatarFormat" placement="right" container="body">
<my-global-icon iconName="upload"></my-global-icon>
<label class="visually-hidden" for="avatarfile" i18n>Upload a new avatar</label>
<input #avatarfileInput type="file" name="avatarfile" id="avatarfile" [accept]="avatarExtensions" (change)="onAvatarChange(avatarfileInput)"/>
</div>
}
}
</div>
<div class="actor-info">

View File

@ -45,6 +45,11 @@
.dropdown-item {
@include dropdown-with-icon-item;
label {
font-weight: normal;
margin: 0;
}
}
.dropdown-toggle::after {

View File

@ -1,3 +1,3 @@
<ng-container i18n>
<a href="https://en.wikipedia.org/wiki/Markdown#Example" target="_blank" rel="noreferrer noopener">Markdown compatible</a> that also supports <a href="https://docs.joinpeertube.org/api/custom-client-markup" target="_blank" rel="noreferrer noopener">custom PeerTube HTML tags</a>
<a class="text-decoration-underline" href="https://en.wikipedia.org/wiki/Markdown#Example" target="_blank" rel="noreferrer noopener">Markdown compatible</a> that also supports <a class="text-decoration-underline" href="https://docs.joinpeertube.org/api/custom-client-markup" target="_blank" rel="noreferrer noopener">custom PeerTube HTML tags</a>
</ng-container>