From 01dfeb4be16f1319d6694a993f269835afd2eb81 Mon Sep 17 00:00:00 2001 From: Audrey Hamelers Date: Wed, 15 Jul 2026 17:16:46 +0200 Subject: [PATCH 1/2] correct focus after interactions --- src/openapi-explorer.js | 7 ++++++- src/utils/common-utils.js | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/openapi-explorer.js b/src/openapi-explorer.js index 88cc7a55..00b8aa37 100644 --- a/src/openapi-explorer.js +++ b/src/openapi-explorer.js @@ -423,6 +423,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 +460,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 +605,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 +646,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/utils/common-utils.js b/src/utils/common-utils.js index 84e534d4..d3d2f1f7 100644 --- a/src/utils/common-utils.js +++ b/src/utils/common-utils.js @@ -47,6 +47,7 @@ export function copyToClipboard(copyData, eventTarget) { setTimeout(() => { btnEl.innerText = getI18nText('operations.copy'); }, 5000); + btnEl.focus(); } } catch (err) { console.error('Unable to copy', err); // eslint-disable-line no-console From 34208b46b0e467c51e61cb0d53c319d3343da766 Mon Sep 17 00:00:00 2001 From: Audrey Hamelers Date: Wed, 15 Jul 2026 18:25:28 +0200 Subject: [PATCH 2/2] remove focus --- src/utils/common-utils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/common-utils.js b/src/utils/common-utils.js index d3d2f1f7..84e534d4 100644 --- a/src/utils/common-utils.js +++ b/src/utils/common-utils.js @@ -47,7 +47,6 @@ export function copyToClipboard(copyData, eventTarget) { setTimeout(() => { btnEl.innerText = getI18nText('operations.copy'); }, 5000); - btnEl.focus(); } } catch (err) { console.error('Unable to copy', err); // eslint-disable-line no-console