mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
Fixes #7001: Focus the main content container when the page loads
This commit is contained in:
parent
a71604e79f
commit
9e1d2da449
BIN
netbox/project-static/dist/netbox-dark.css
vendored
BIN
netbox/project-static/dist/netbox-dark.css
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox-light.css
vendored
BIN
netbox/project-static/dist/netbox-light.css
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox-print.css
vendored
BIN
netbox/project-static/dist/netbox-print.css
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox.js
vendored
BIN
netbox/project-static/dist/netbox.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox.js.map
vendored
BIN
netbox/project-static/dist/netbox.js.map
vendored
Binary file not shown.
@ -13,7 +13,7 @@ import { initSideNav } from './sidenav';
|
|||||||
import { initRackElevation } from './racks';
|
import { initRackElevation } from './racks';
|
||||||
import { initLinks } from './links';
|
import { initLinks } from './links';
|
||||||
|
|
||||||
function initAll() {
|
function initDocument() {
|
||||||
for (const init of [
|
for (const init of [
|
||||||
initBootstrap,
|
initBootstrap,
|
||||||
initColorMode,
|
initColorMode,
|
||||||
@ -34,8 +34,18 @@ function initAll() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.readyState !== 'loading') {
|
function initWindow() {
|
||||||
initAll();
|
const contentContainer = document.querySelector<HTMLElement>('.content-container');
|
||||||
} else {
|
if (contentContainer !== null) {
|
||||||
document.addEventListener('DOMContentLoaded', initAll);
|
// Focus the content container for accessible navigation.
|
||||||
|
contentContainer.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('load', initWindow);
|
||||||
|
|
||||||
|
if (document.readyState !== 'loading') {
|
||||||
|
initDocument();
|
||||||
|
} else {
|
||||||
|
document.addEventListener('DOMContentLoaded', initDocument);
|
||||||
}
|
}
|
||||||
|
@ -529,14 +529,20 @@ div.content-container {
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
@include media-breakpoint-down(lg) {
|
// Don't show an outline when the content container is focused.
|
||||||
width: 100%;
|
&:focus,
|
||||||
|
&:focus-visible {
|
||||||
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.content {
|
div.content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@include media-breakpoint-down(lg) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
// Make the content full-width when printing.
|
// Make the content full-width when printing.
|
||||||
@media print {
|
@media print {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
{% include 'base/sidenav.html' %}
|
{% include 'base/sidenav.html' %}
|
||||||
|
|
||||||
{# Body #}
|
{# Body #}
|
||||||
<div class="content-container">
|
<div class="content-container" tabindex="-2">
|
||||||
|
|
||||||
{# Netbox Logo, only visible when printing #}
|
{# Netbox Logo, only visible when printing #}
|
||||||
<div class="p-2 printonly">
|
<div class="p-2 printonly">
|
||||||
|
Loading…
Reference in New Issue
Block a user