A11y - Each page should have only one main

https://www.w3.org/TR/wai-aria-practices/examples/landmarks/main.html

Change-Id: I50acdc27619f38268d8bda5a5f2477679e66270b
This commit is contained in:
Milutin Kristofic
2021-01-20 14:58:44 +01:00
parent 003d3eb572
commit 3caa3c0b38
10 changed files with 45 additions and 45 deletions

View File

@@ -51,7 +51,7 @@ export const htmlTemplate = html`
.selectText.show { .selectText.show {
display: inline-block; display: inline-block;
} }
main.breadcrumbs:not(.table) { .main.breadcrumbs:not(.table) {
margin-top: var(--spacing-l); margin-top: var(--spacing-l);
} }
</style> </style>
@@ -114,69 +114,69 @@ export const htmlTemplate = html`
</section> </section>
</template> </template>
<template is="dom-if" if="[[_showRepoList]]" restamp="true"> <template is="dom-if" if="[[_showRepoList]]" restamp="true">
<main class="table"> <div class="main table">
<gr-repo-list class="table" params="[[params]]"></gr-repo-list> <gr-repo-list class="table" params="[[params]]"></gr-repo-list>
</main> </div>
</template> </template>
<template is="dom-if" if="[[_showGroupList]]" restamp="true"> <template is="dom-if" if="[[_showGroupList]]" restamp="true">
<main class="table"> <div class="main table">
<gr-admin-group-list class="table" params="[[params]]"> <gr-admin-group-list class="table" params="[[params]]">
</gr-admin-group-list> </gr-admin-group-list>
</main> </div>
</template> </template>
<template is="dom-if" if="[[_showPluginList]]" restamp="true"> <template is="dom-if" if="[[_showPluginList]]" restamp="true">
<main class="table"> <div class="main table">
<gr-plugin-list class="table" params="[[params]]"></gr-plugin-list> <gr-plugin-list class="table" params="[[params]]"></gr-plugin-list>
</main> </div>
</template> </template>
<template is="dom-if" if="[[_showRepoMain]]" restamp="true"> <template is="dom-if" if="[[_showRepoMain]]" restamp="true">
<main class="breadcrumbs"> <div class="main breadcrumbs">
<gr-repo repo="[[params.repo]]"></gr-repo> <gr-repo repo="[[params.repo]]"></gr-repo>
</main> </div>
</template> </template>
<template is="dom-if" if="[[_showGroup]]" restamp="true"> <template is="dom-if" if="[[_showGroup]]" restamp="true">
<main class="breadcrumbs"> <div class="main breadcrumbs">
<gr-group <gr-group
group-id="[[params.groupId]]" group-id="[[params.groupId]]"
on-name-changed="_updateGroupName" on-name-changed="_updateGroupName"
></gr-group> ></gr-group>
</main> </div>
</template> </template>
<template is="dom-if" if="[[_showGroupMembers]]" restamp="true"> <template is="dom-if" if="[[_showGroupMembers]]" restamp="true">
<main class="breadcrumbs"> <div class="main breadcrumbs">
<gr-group-members group-id="[[params.groupId]]"></gr-group-members> <gr-group-members group-id="[[params.groupId]]"></gr-group-members>
</main> </div>
</template> </template>
<template is="dom-if" if="[[_showRepoDetailList]]" restamp="true"> <template is="dom-if" if="[[_showRepoDetailList]]" restamp="true">
<main class="table breadcrumbs"> <div class="main table breadcrumbs">
<gr-repo-detail-list <gr-repo-detail-list
params="[[params]]" params="[[params]]"
class="table" class="table"
></gr-repo-detail-list> ></gr-repo-detail-list>
</main> </div>
</template> </template>
<template is="dom-if" if="[[_showGroupAuditLog]]" restamp="true"> <template is="dom-if" if="[[_showGroupAuditLog]]" restamp="true">
<main class="table breadcrumbs"> <div class="main table breadcrumbs">
<gr-group-audit-log <gr-group-audit-log
group-id="[[params.groupId]]" group-id="[[params.groupId]]"
class="table" class="table"
></gr-group-audit-log> ></gr-group-audit-log>
</main> </div>
</template> </template>
<template is="dom-if" if="[[_showRepoCommands]]" restamp="true"> <template is="dom-if" if="[[_showRepoCommands]]" restamp="true">
<main class="breadcrumbs"> <div class="main breadcrumbs">
<gr-repo-commands repo="[[params.repo]]"></gr-repo-commands> <gr-repo-commands repo="[[params.repo]]"></gr-repo-commands>
</main> </div>
</template> </template>
<template is="dom-if" if="[[_showRepoAccess]]" restamp="true"> <template is="dom-if" if="[[_showRepoAccess]]" restamp="true">
<main class="breadcrumbs"> <div class="main breadcrumbs">
<gr-repo-access path="[[path]]" repo="[[params.repo]]"></gr-repo-access> <gr-repo-access path="[[path]]" repo="[[params.repo]]"></gr-repo-access>
</main> </div>
</template> </template>
<template is="dom-if" if="[[_showRepoDashboards]]" restamp="true"> <template is="dom-if" if="[[_showRepoDashboards]]" restamp="true">
<main class="table breadcrumbs"> <div class="main table breadcrumbs">
<gr-repo-dashboards repo="[[params.repo]]"></gr-repo-dashboards> <gr-repo-dashboards repo="[[params.repo]]"></gr-repo-dashboards>
</main> </div>
</template> </template>
<gr-js-api-interface id="jsAPI"></gr-js-api-interface> <gr-js-api-interface id="jsAPI"></gr-js-api-interface>
`; `;

View File

@@ -56,8 +56,8 @@ export const htmlTemplate = html`
display: none; display: none;
} }
</style> </style>
<main <div
class$="gr-form-styles [[_computeHideItemClass(_groupOwner, _isAdmin)]]" class$="main gr-form-styles [[_computeHideItemClass(_groupOwner, _isAdmin)]]"
> >
<div id="loading" class$="[[_computeLoadingClass(_loading)]]"> <div id="loading" class$="[[_computeLoadingClass(_loading)]]">
Loading... Loading...
@@ -170,7 +170,7 @@ export const htmlTemplate = html`
</fieldset> </fieldset>
</div> </div>
</div> </div>
</main> </div>
<gr-overlay id="overlay" with-backdrop=""> <gr-overlay id="overlay" with-backdrop="">
<gr-confirm-delete-item-dialog <gr-confirm-delete-item-dialog
class="confirmDialog" class="confirmDialog"

View File

@@ -32,7 +32,7 @@ export const htmlTemplate = html`
<style include="gr-form-styles"> <style include="gr-form-styles">
/* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */ /* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */
</style> </style>
<main class="gr-form-styles read-only"> <div class="main gr-form-styles read-only">
<div id="loading" class$="[[_computeLoadingClass(_loading)]]"> <div id="loading" class$="[[_computeLoadingClass(_loading)]]">
Loading... Loading...
</div> </div>
@@ -164,5 +164,5 @@ export const htmlTemplate = html`
</fieldset> </fieldset>
</div> </div>
</div> </div>
</main> </div>
`; `;

View File

@@ -60,7 +60,7 @@ export const htmlTemplate = html`
<style include="gr-menu-page-styles"> <style include="gr-menu-page-styles">
/* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */ /* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */
</style> </style>
<main class$="[[_computeMainClass(_ownerOf, _canUpload, _editing)]]"> <div class$="main [[_computeMainClass(_ownerOf, _canUpload, _editing)]]">
<div id="loading" class$="[[_computeLoadingClass(_loading)]]"> <div id="loading" class$="[[_computeLoadingClass(_loading)]]">
Loading... Loading...
</div> </div>
@@ -142,5 +142,5 @@ export const htmlTemplate = html`
> >
</div> </div>
</div> </div>
</main> </div>
`; `;

View File

@@ -28,7 +28,7 @@ export const htmlTemplate = html`
margin-bottom: var(--spacing-xxl); margin-bottom: var(--spacing-xxl);
} }
</style> </style>
<main class="gr-form-styles read-only"> <div class="main gr-form-styles read-only">
<h1 id="Title" class="heading-1">Repository Commands</h1> <h1 id="Title" class="heading-1">Repository Commands</h1>
<div id="loading" class$="[[_computeLoadingClass(_loading)]]"> <div id="loading" class$="[[_computeLoadingClass(_loading)]]">
Loading... Loading...
@@ -67,7 +67,7 @@ export const htmlTemplate = html`
</gr-endpoint-decorator> </gr-endpoint-decorator>
</div> </div>
</div> </div>
</main> </div>
<gr-overlay id="createChangeOverlay" with-backdrop=""> <gr-overlay id="createChangeOverlay" with-backdrop="">
<gr-dialog <gr-dialog
id="createChangeDialog" id="createChangeDialog"

View File

@@ -45,7 +45,7 @@ export const htmlTemplate = html`
<style include="gr-form-styles"> <style include="gr-form-styles">
/* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */ /* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */
</style> </style>
<main class="gr-form-styles read-only"> <div class="main gr-form-styles read-only">
<style include="shared-styles"> <style include="shared-styles">
/* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */ /* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */
</style> </style>
@@ -435,5 +435,5 @@ export const htmlTemplate = html`
</gr-endpoint-decorator> </gr-endpoint-decorator>
</div> </div>
</div> </div>
</main> </div>
`; `;

View File

@@ -33,7 +33,7 @@ export const htmlTemplate = html`
#email { #email {
margin-bottom: var(--spacing-l); margin-bottom: var(--spacing-l);
} }
main section.darkToggle { .main section.darkToggle {
display: block; display: block;
} }
.filters p, .filters p,
@@ -99,7 +99,7 @@ export const htmlTemplate = html`
</gr-endpoint-decorator> </gr-endpoint-decorator>
</ul> </ul>
</gr-page-nav> </gr-page-nav>
<main class="gr-form-styles"> <div class="main gr-form-styles">
<h1 class="heading-1">User Settings</h1> <h1 class="heading-1">User Settings</h1>
<section class="darkToggle"> <section class="darkToggle">
<div class="toggle"> <div class="toggle">
@@ -551,6 +551,6 @@ export const htmlTemplate = html`
</table> </table>
</fieldset> </fieldset>
<gr-endpoint-decorator name="settings-screen"> </gr-endpoint-decorator> <gr-endpoint-decorator name="settings-screen"> </gr-endpoint-decorator>
</main> </div>
</div> </div>
`; `;

View File

@@ -36,7 +36,7 @@ export const htmlTemplate = html`
} }
} }
</style> </style>
<nav id="nav"> <nav id="nav" aria-label="Sidebar">
<slot></slot> <slot></slot>
</nav> </nav>
`; `;

View File

@@ -28,7 +28,7 @@ $_documentContainer.innerHTML = `<dom-module id="gr-menu-page-styles">
:host { :host {
display: block; display: block;
} }
main { .main {
margin: var(--spacing-xxl) auto; margin: var(--spacing-xxl) auto;
max-width: 50em; max-width: 50em;
} }
@@ -36,7 +36,7 @@ $_documentContainer.innerHTML = `<dom-module id="gr-menu-page-styles">
margin-left: 14em; margin-left: 14em;
padding: var(--spacing-l) 0 var(--spacing-l) var(--spacing-xxl); padding: var(--spacing-l) 0 var(--spacing-l) var(--spacing-xxl);
} }
main.table, .main.table,
.mainHeader { .mainHeader {
margin-top: 0; margin-top: 0;
margin-right: 0; margin-right: 0;
@@ -52,10 +52,10 @@ $_documentContainer.innerHTML = `<dom-module id="gr-menu-page-styles">
padding: var(--spacing-l); padding: var(--spacing-l);
} }
@media only screen and (max-width: 67em) { @media only screen and (max-width: 67em) {
main { .main {
margin: var(--spacing-xxl) 0 var(--spacing-xxl) 15em; margin: var(--spacing-xxl) 0 var(--spacing-xxl) 15em;
} }
main.table { .main.table {
margin-left: 14em; margin-left: 14em;
} }
} }
@@ -63,10 +63,10 @@ $_documentContainer.innerHTML = `<dom-module id="gr-menu-page-styles">
.loading { .loading {
padding: 0 var(--spacing-l); padding: 0 var(--spacing-l);
} }
main { .main {
margin: var(--spacing-xxl) var(--spacing-l); margin: var(--spacing-xxl) var(--spacing-l);
} }
main.table { .main.table {
margin: 0; margin: 0;
} }
.mainHeader { .mainHeader {

View File

@@ -25,7 +25,7 @@ const $_documentContainer = document.createElement('template');
$_documentContainer.innerHTML = `<dom-module id="gr-subpage-styles"> $_documentContainer.innerHTML = `<dom-module id="gr-subpage-styles">
<template> <template>
<style> <style>
main { .main {
margin: var(--spacing-l); margin: var(--spacing-l);
} }
.loading { .loading {