Fix menu accessibility

Signed-off-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
Chocobozzz 2024-11-27 14:22:06 +01:00
parent c4c6d43da3
commit f27beec235
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
5 changed files with 28 additions and 13 deletions

View File

@ -9,7 +9,10 @@
<div class="d-flex align-items-center buttons-container"> <div class="d-flex align-items-center buttons-container">
@if (!loggedIn) { @if (!loggedIn) {
<my-button theme="tertiary" rounded="true" class="margin-button settings-button" icon="cog" (click)="openQuickSettings()"></my-button> <my-button
i18n-title title="Open settings modal"
theme="tertiary" rounded="true" class="margin-button settings-button" icon="cog" (click)="openQuickSettings()"
></my-button>
<a *ngIf="isRegistrationAllowed()" routerLink="/signup" class="peertube-button-link secondary-button w-100 ellipsis margin-button create-account-button"> <a *ngIf="isRegistrationAllowed()" routerLink="/signup" class="peertube-button-link secondary-button w-100 ellipsis margin-button create-account-button">
<my-signup-label [requiresApproval]="requiresApproval"></my-signup-label> <my-signup-label [requiresApproval]="requiresApproval"></my-signup-label>

View File

@ -51,6 +51,7 @@
my-search-typeahead { my-search-typeahead {
max-width: 270px; max-width: 270px;
width: 100%;
@include margin-right(1.5rem); @include margin-right(1.5rem);
} }

View File

@ -1,5 +1,5 @@
<ng-template #moreInfoButton> <ng-template #moreInfoButton>
<my-button i18n class="mt-2 d-block" theme="secondary" icon="help" i18n-ariaLabel aria-label="More info" i18n ptRouterLink="/about" ptRouterLinkActive="active"> <my-button i18n class="mt-2 d-block" theme="secondary" icon="help" i18n-title title="More info" i18n ptRouterLink="/about" ptRouterLinkActive="active">
@if (!collapsed) { @if (!collapsed) {
More info More info
} }
@ -20,11 +20,11 @@
<div class="toggle-menu-container"> <div class="toggle-menu-container">
@if (collapsed) { @if (collapsed) {
<button type="button" class="button-unstyle toggle-menu" i18n-title title="Display the lateral bar" (click)="toggleMenu()"> <button type="button" class="button-unstyle toggle-menu" i18n-title title="Display the lateral menu" (click)="toggleMenu()">
<my-global-icon class="transform-rotate-180" iconName="chevron-left"></my-global-icon> <my-global-icon class="transform-rotate-180" iconName="chevron-left"></my-global-icon>
</button> </button>
} @else { } @else {
<button type="button" class="button-unstyle toggle-menu" i18n-title title= "Hide the lateral bar" (click)="toggleMenu()"> <button type="button" class="button-unstyle toggle-menu" i18n-title title= "Hide the lateral menu" (click)="toggleMenu()">
<my-global-icon iconName="chevron-left"></my-global-icon> <my-global-icon iconName="chevron-left"></my-global-icon>
</button> </button>
} }
@ -47,13 +47,13 @@
<ul class="ul-unstyle"> <ul class="ul-unstyle">
<li *ngFor="let link of menuSection.links"> <li *ngFor="let link of menuSection.links">
@if (link.isPrimaryButton === true) { @if (link.isPrimaryButton === true) {
<my-button class="d-block menu-button" [ngClass]="link.ngClass" theme="primary" [icon]="link.icon" [ariaLabel]="link.label" [ptRouterLink]="link.path"> <my-button class="d-block menu-button" [ngClass]="link.ngClass" theme="primary" [icon]="link.icon" [title]="link.label" [ptRouterLink]="link.path">
@if (!collapsed) { @if (!collapsed) {
{{ link.label }} {{ link.label }}
} }
</my-button> </my-button>
} @else { } @else {
<a class="menu-link ellipsis" [routerLink]="link.path" routerLinkActive="active" [ngClass]="link.ngClass"> <a class="menu-link ellipsis" [routerLink]="link.path" routerLinkActive="active" [ngClass]="link.ngClass" [title]="link.label">
<my-global-icon *ngIf="link.icon" [iconName]="link.icon" [ngClass]="link.iconClass" aria-hidden="true"></my-global-icon> <my-global-icon *ngIf="link.icon" [iconName]="link.icon" [ngClass]="link.iconClass" aria-hidden="true"></my-global-icon>
<span [ngClass]="{ 'visually-hidden': collapsed }">{{ link.label }}</span> <span [ngClass]="{ 'visually-hidden': collapsed }">{{ link.label }}</span>
</a> </a>

View File

@ -27,7 +27,7 @@
width: 24px; width: 24px;
height: 24px; height: 24px;
border-radius: 100%; border-radius: 100%;
background-color: pvar-fallback(--menu-bg, --bg-secondary-500); background-color: pvar-fallback(--menu-bg, --bg-secondary-450);
@include button-with-icon(20px, 0, 0, 1px); @include button-with-icon(20px, 0, 0, 1px);
@ -116,9 +116,7 @@
margin: 1rem auto; margin: 1rem auto;
} }
} }
}
.collapsed {
.main-menu-wrapper { .main-menu-wrapper {
max-height: 100%; max-height: 100%;
} }
@ -137,6 +135,10 @@
.menu-link { .menu-link {
justify-content: center; justify-content: center;
my-global-icon {
color: pvar-fallback(--menu-fg, --fg-400);
}
} }
} }
@ -179,7 +181,6 @@
line-height: 22px; line-height: 22px;
position: relative; position: relative;
top: -1px; top: -1px;
color: pvar-fallback(--menu-fg, --secondary-icon-color);
+ *:not(.visually-hidden) { + *:not(.visually-hidden) {
@include margin-left(12px); @include margin-left(12px);
@ -198,10 +199,18 @@
} }
} }
my-button[theme=secondary] ::ng-deep my-global-icon { my-button[theme=secondary] ::ng-deep my-global-icon,
.menu-link my-global-icon {
color: pvar(--secondary-icon-color) !important; color: pvar(--secondary-icon-color) !important;
} }
.collapsed {
my-button[theme=secondary] ::ng-deep my-global-icon,
.menu-link my-global-icon {
color: pvar(--fg-200) !important;
}
}
.menu-overlay { .menu-overlay {
background-color: #000; background-color: #000;
width: 100vw; width: 100vw;

View File

@ -17,8 +17,6 @@ $more-button-width: 40px;
} }
.video-info { .video-info {
width: calc(100% - #{$more-button-width});
display: grid; display: grid;
} }
@ -92,6 +90,10 @@ $more-button-width: 40px;
padding-bottom: 1rem; padding-bottom: 1rem;
width: 100%; width: 100%;
.video-info {
width: calc(100% - #{$more-button-width});
}
my-video-thumbnail { my-video-thumbnail {
margin-bottom: 0.35rem; margin-bottom: 0.35rem;