diff --git a/src/core/components/layouts/base.jsx b/src/core/components/layouts/base.jsx index 04807aa2ee7..e5f0b52bfda 100644 --- a/src/core/components/layouts/base.jsx +++ b/src/core/components/layouts/base.jsx @@ -128,25 +128,27 @@ export default class BaseLayout extends React.Component { - - - - - - - {isOAS31 && ( - +
+ - + - )} - - - - - + {isOAS31 && ( + + + + + + )} + + + + + + +
) diff --git a/src/standalone/plugins/stadalone-layout/components/StandaloneLayout.jsx b/src/standalone/plugins/stadalone-layout/components/StandaloneLayout.jsx index 6703a2b2eef..ee09bd9c138 100644 --- a/src/standalone/plugins/stadalone-layout/components/StandaloneLayout.jsx +++ b/src/standalone/plugins/stadalone-layout/components/StandaloneLayout.jsx @@ -24,7 +24,25 @@ class StandaloneLayout extends React.Component { return ( - {Topbar ? : null} + { + e.preventDefault() + // Scope the lookup to this swagger-ui instance so the link + // works correctly when multiple instances are mounted. + const target = e.currentTarget + .closest(".swagger-ui") + ?.querySelector("#operations") + if (target) { + target.focus() + target.scrollIntoView() + } + }} + > + Skip to operations + + {Topbar ?
: null} diff --git a/src/style/_layout.scss b/src/style/_layout.scss index 88e7d4347e7..8332d6ff78e 100644 --- a/src/style/_layout.scss +++ b/src/style/_layout.scss @@ -3,6 +3,37 @@ @use "type"; @use "mixins"; +.swagger-ui__skip-link { + clip: rect(0 0 0 0); + clip-path: inset(50%); + height: 1px; + overflow: hidden; + position: absolute; + white-space: nowrap; + width: 1px; + + &:focus { + clip: auto; + clip-path: none; + height: auto; + width: auto; + overflow: visible; + position: fixed; + top: 8px; + left: 8px; + z-index: 10000; + padding: 8px 16px; + background: $white; + color: $bright-gray; + border: 1px solid $geyser-blue; + border-radius: 4px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); + font-size: 14px; + font-weight: 600; + text-decoration: none; + } +} + .wrapper { width: 100%; max-width: 1460px;