Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions src/core/components/layouts/base.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,27 @@ export default class BaseLayout extends React.Component {

<FilterContainer />

<Row>
<Col mobile={12} desktop={12}>
<Operations />
</Col>
</Row>

{isOAS31 && (
<Row className="webhooks-container">
<main id="operations" tabIndex="-1" style={{ outline: "none" }}>
<Row>
<Col mobile={12} desktop={12}>
<Webhooks />
<Operations />
</Col>
</Row>
)}

<Row>
<Col mobile={12} desktop={12}>
<Models />
</Col>
</Row>
{isOAS31 && (
<Row className="webhooks-container">
<Col mobile={12} desktop={12}>
<Webhooks />
</Col>
</Row>
)}

<Row>
<Col mobile={12} desktop={12}>
<Models />
</Col>
</Row>
</main>
</VersionPragmaFilter>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,25 @@ class StandaloneLayout extends React.Component {

return (
<Container className='swagger-ui'>
{Topbar ? <Topbar /> : null}
<a
href="#operations"
className="swagger-ui__skip-link"
onClick={(e) => {
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
</a>
{Topbar ? <header role="banner"><Topbar /></header> : null}
<BaseLayout />
<Row>
<Col>
Expand Down
31 changes: 31 additions & 0 deletions src/style/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down