${Array.isArray(data) && data[0] ? html`${this.generateTree(data[0], 'xxx-of-option', '', data[0]['::flags'] || {}, '::ARRAY~OF', data[0]['::title'], data[0]['::description'], newSchemaLevel, newIndentLevel)}`
: html`
@@ -326,6 +329,7 @@ export default class SchemaTree extends LitElement {
const rowEl = e.target.closest('.tr');
rowEl.classList.toggle('collapsed');
+ e.target.setAttribute('aria-expanded', !rowEl.classList.contains('collapsed'));
if (rowEl.classList.contains('collapsed')) {
e.target.innerHTML = e.target.classList.contains('array-of-object')
? '[{...}]'
diff --git a/src/openapi-explorer.js b/src/openapi-explorer.js
index 88cc7a55..ad61cca6 100644
--- a/src/openapi-explorer.js
+++ b/src/openapi-explorer.js
@@ -311,6 +311,7 @@ export default class OpenApiExplorer extends LitElement {
async onShowSearchModalClicked() {
this.showAdvancedSearchDialog = true;
// wait for the dialog to render
+ this.shadowRoot.getElementById('nav-advanced-search').setAttribute('aria-expanded', true);
await sleep(10);
const inputEl = this.shadowRoot.getElementById('advanced-search-dialog-input');
if (inputEl) {
@@ -423,6 +424,7 @@ export default class OpenApiExplorer extends LitElement {
const gotoEl = this.shadowRoot.getElementById(tmpElementId);
if (gotoEl) {
gotoEl.scrollIntoView({ behavior: 'auto', block: 'start' });
+ gotoEl.focus();
replaceState(tmpElementId);
}
}, isExpandingNeeded ? 150 : 0);
@@ -459,6 +461,7 @@ export default class OpenApiExplorer extends LitElement {
const gotoEl = this.shadowRoot.getElementById(anchor.replace('#', ''));
if (gotoEl) {
gotoEl.scrollIntoView({ behavior: 'auto', block: 'start' });
+ gotoEl.focus();
}
}
}
@@ -603,19 +606,21 @@ export default class OpenApiExplorer extends LitElement {
component.expanded = true;
}
contentEl.scrollIntoView({ behavior: 'auto', block: 'start' });
+ contentEl.focus();
// Update Location Hash
replaceState(elementId);
newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
} else if (elementId.match('cmp--') || elementId.match('tag--') || elementId.match('overview--') || elementId.match('auth--') || elementId.match('servers--')) {
contentEl.scrollIntoView({ behavior: 'auto', block: 'start' });
+ contentEl.focus();
// Update Location Hash
replaceState(elementId);
newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
} else {
this.shadowRoot.getElementById('operations-root').scrollIntoView({ behavior: 'auto', block: 'start' });
-
+ this.shadowRoot.getElementById('operations-root').focus();
// Update Location Hash
replaceState(elementId);
newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
@@ -642,6 +647,7 @@ export default class OpenApiExplorer extends LitElement {
if (waitForComponentToExpand) {
setTimeout(() => newNavEl.scrollIntoView({ behavior: 'auto', block: 'center' }), 600);
}
+ newNavEl.focus();
}
await sleep(0);
diff --git a/src/styles/endpoint-styles.js b/src/styles/endpoint-styles.js
index 1af72bb4..2e4daf36 100644
--- a/src/styles/endpoint-styles.js
+++ b/src/styles/endpoint-styles.js
@@ -21,7 +21,7 @@ export default css`
}
.m-endpoint.expanded{margin-bottom:16px; }
-.m-endpoint > .endpoint-head{
+.m-endpoint .endpoint-head{
border-width:1px 1px 1px 5px;
border-style:solid;
border-color:transparent;
@@ -31,45 +31,45 @@ export default css`
align-items: center;
cursor: pointer;
}
-.m-endpoint > .endpoint-head.put:hover,
-.m-endpoint > .endpoint-head.put.expanded{
+.m-endpoint .endpoint-head.put:hover,
+.m-endpoint .endpoint-head.put.expanded{
border-color: var(--orange);
background-color: var(--light-orange);
}
-.m-endpoint > .endpoint-head.post:hover,
-.m-endpoint > .endpoint-head.post.expanded {
+.m-endpoint .endpoint-head.post:hover,
+.m-endpoint .endpoint-head.post.expanded {
border-color:var(--green);
background-color: var(--light-green);
}
-.m-endpoint > .endpoint-head.get:hover,
-.m-endpoint > .endpoint-head.get.expanded,
-.m-endpoint > .endpoint-head.head:hover,
-.m-endpoint > .endpoint-head.head.expanded {
+.m-endpoint .endpoint-head.get:hover,
+.m-endpoint .endpoint-head.get.expanded,
+.m-endpoint .endpoint-head.head:hover,
+.m-endpoint .endpoint-head.head.expanded {
border-color:var(--blue);
background-color: var(--light-blue);
}
-.m-endpoint > .endpoint-head.delete:hover,
-.m-endpoint > .endpoint-head.delete.expanded {
+.m-endpoint .endpoint-head.delete:hover,
+.m-endpoint .endpoint-head.delete.expanded {
border-color:var(--red);
background-color: var(--light-red);
}
-.m-endpoint > .endpoint-head.patch:hover,
-.m-endpoint > .endpoint-head.patch.expanded {
+.m-endpoint .endpoint-head.patch:hover,
+.m-endpoint .endpoint-head.patch.expanded {
border-color :var(--yellow);
background-color: var(--light-yellow);
}
-.m-endpoint > .endpoint-head.query:hover,
-.m-endpoint > .endpoint-head.query.expanded {
+.m-endpoint .endpoint-head.query:hover,
+.m-endpoint .endpoint-head.query.expanded {
border-color: var(--purple);
background-color: var(--light-purple);
}
-.m-endpoint > .endpoint-head.trace:hover,
-.m-endpoint > .endpoint-head.trace.expanded {
+.m-endpoint .endpoint-head.trace:hover,
+.m-endpoint .endpoint-head.trace.expanded {
border-color: var(--purple);
background-color: var(--light-purple);
}
-.m-endpoint > .endpoint-head.options:hover,
-.m-endpoint > .endpoint-head.options.expanded {
+.m-endpoint .endpoint-head.options:hover,
+.m-endpoint .endpoint-head.options.expanded {
border-color: var(--gray);
background-color: var(--light-gray);
}
diff --git a/src/templates/advance-search-template.js b/src/templates/advance-search-template.js
index 56f7e113..d81e6ea2 100644
--- a/src/templates/advance-search-template.js
+++ b/src/templates/advance-search-template.js
@@ -12,6 +12,7 @@ export default function searchByPropertiesModalTemplate() {
// Trigger the event to force it to be removed from the DOM
document.dispatchEvent(new CustomEvent('keydown', { detail: { code: 'Escape' } }));
document.removeEventListener('keydown', keyDownEventListenerAdvancedSearch, { once: true });
+ this.shadowRoot.getElementById('nav-advanced-search').setAttribute('aria-expanded', false);
};
document.addEventListener('keydown', keyDownEventListenerAdvancedSearch, { once: true });
@@ -20,10 +21,10 @@ export default function searchByPropertiesModalTemplate() {
${this.showAdvancedSearchDialog
? html`
-
+
diff --git a/src/templates/endpoint-template.js b/src/templates/endpoint-template.js
index 38afbb12..ce07017b 100644
--- a/src/templates/endpoint-template.js
+++ b/src/templates/endpoint-template.js
@@ -43,16 +43,18 @@ export function expandCollapseComponent(component) {
/* eslint-disable indent */
function endpointHeadTemplate(path) {
return html`
- { toggleExpand.call(this, path, e); }}" class='endpoint-head ${path.method} ${path.expanded ? 'expanded' : 'collapsed'}'>
- ${path.method}
-
- ${this.usePathInNavBar
- ? html`
${path.path.split('/').filter(t => t.trim()).map(t => html`/${t}`)}
`
- : html`
${path.summary || path.shortSummary}
`
- }
- ${path.isWebhook ? html`
(${getI18nText('operations.webhook')}) ` : ''}
+
+
{ toggleExpand.call(this, path, e); }}" @keydown="${(e) => { if (e.key === 'Enter') { e.target.click(); }}}" aria-controls="${path.elementId}" aria-expanded="${path.expanded}">
+
${path.method}
+
+ ${this.usePathInNavBar
+ ? html`
${path.path.split('/').filter(t => t.trim()).map(t => html`/${t}`)}
`
+ : html`
${path.summary || path.shortSummary}
`
+ }
+ ${path.isWebhook ? html`
(${getI18nText('operations.webhook')}) ` : ''}
+
-
+
`;
}
@@ -125,9 +127,9 @@ function endpointBodyTemplate(path) {
export default function endpointTemplate() {
return html`
- expandCollapseAll.call(this, e, true)}" style="color:var(--primary-color); cursor: pointer;">Expand
+ expandCollapseAll.call(this, e, true)}" style="color:var(--primary-color); cursor: pointer;" role="button" tabindex="0" @keydown="${(e) => { if (e.key === 'Enter') { e.target.click(); }}}">Expand
|
- expandCollapseAll.call(this, e, false)}" style="color:var(--primary-color); cursor: pointer;">Collapse
+ expandCollapseAll.call(this, e, false)}" style="color:var(--primary-color); cursor: pointer;" role="button" tabindex="0" @keydown="${(e) => { if (e.key === 'Enter') { e.target.click(); }}}">Collapse
${(this.resolvedSpec && this.resolvedSpec.tags || []).map((tag) => html`
diff --git a/src/templates/expanded-endpoint-template.js b/src/templates/expanded-endpoint-template.js
index 07eb0f68..6b38caac 100644
--- a/src/templates/expanded-endpoint-template.js
+++ b/src/templates/expanded-endpoint-template.js
@@ -20,8 +20,8 @@ export function expandedEndpointBodyTemplate(path, tag) {
${this.renderStyle === 'read' ? html`
` : ''}
${(this.renderStyle === 'focused' && tag && tag.name !== 'General ⦂')
- ? html`
this.scrollToEventTarget(e, false)}"> ${tag?.name} ${tagSummary}
`
+ ? html`
this.scrollToEventTarget(e, false)}" @keydown="${(e) => { if (e.key === 'Enter') { e.target.click(); }}}"> ${tag?.name} ${tagSummary}
`
: ''}
diff --git a/src/templates/navbar-template.js b/src/templates/navbar-template.js
index b6016030..b03d3295 100644
--- a/src/templates/navbar-template.js
+++ b/src/templates/navbar-template.js
@@ -50,17 +50,17 @@ export default function navbarTemplate() {
${this.hideSearch ? ''
: html`
-
-
+
+
+
-
@@ -108,7 +108,7 @@ export default function navbarTemplate() {
this.scrollToCustomNavSectionTarget(e, false)}'>
-