Improved tabbing behavior in tabs mode

This commit is contained in:
squidfunk 2018-01-11 22:23:04 +01:00 committed by Martin Donath
parent 4026513889
commit 1020185c82
6 changed files with 28 additions and 15 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -46,7 +46,7 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application.4b085d0e.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application.46d65e19.css">
{% if palette.primary or palette.accent %} {% if palette.primary or palette.accent %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-palette.792431c1.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-palette.792431c1.css">
{% endif %} {% endif %}
@ -167,7 +167,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application.98974103.js"></script> <script src="{{ base_url }}/assets/javascripts/application.d5140e78.js"></script>
{% if lang.t("search.language") != "en" %} {% if lang.t("search.language") != "en" %}
{% set languages = lang.t("search.language").split(",") %} {% set languages = lang.t("search.language").split(",") %}
{% if languages | length and languages[0] != "" %} {% if languages | length and languages[0] != "" %}

View File

@ -304,6 +304,7 @@ function initialize(config) { // eslint-disable-line func-style
const labels = document.querySelectorAll( const labels = document.querySelectorAll(
"[data-md-component=navigation] .md-nav__link[for]:not([tabindex])") "[data-md-component=navigation] .md-nav__link[for]:not([tabindex])")
Array.prototype.forEach.call(labels, label => { Array.prototype.forEach.call(labels, label => {
if (label.offsetHeight)
label.tabIndex = 0 label.tabIndex = 0
}) })
} }

View File

@ -108,6 +108,7 @@
// font-size to zero, as we need to preserve bottom padding // font-size to zero, as we need to preserve bottom padding
~ .md-main .md-nav--primary > .md-nav__list > .md-nav__item--nested { ~ .md-main .md-nav--primary > .md-nav__list > .md-nav__item--nested {
font-size: 0; font-size: 0;
visibility: hidden;
} }
// We're on the 2nd+ level // We're on the 2nd+ level
@ -116,6 +117,17 @@
// Adjust 1st level styles // Adjust 1st level styles
.md-nav--primary { .md-nav--primary {
// // Hide titles for nested navigation
// &__item--nested > .md-nav > &__title {
// display: none;
// }
// Show title and remove spacing
.md-nav__title {
display: block;
padding: 0;
}
// Hide site title // Hide site title
.md-nav__title--site { .md-nav__title--site {
display: none; display: none;
@ -124,25 +136,20 @@
// Hide 1st level normal items // Hide 1st level normal items
& > .md-nav__list > .md-nav__item { & > .md-nav__list > .md-nav__item {
font-size: 0; font-size: 0;
visibility: hidden;
// Reset font-size for nested items and induce margin collapse // Reset font-size for nested items and induce margin collapse
&--nested { &--nested {
display: none; display: none;
font-size: 1.4rem; font-size: 1.4rem;
overflow: auto; overflow: auto;
visibility: visible;
// Render link same as main navigation title // Hide nested links
> .md-nav__link { > .md-nav__link {
margin-top: 0;
font-weight: 700;
pointer-events: none;
// Hide icon for expansion
&::after {
display: none; display: none;
} }
} }
}
// Show 1st level active nested items // Show 1st level active nested items
&--active { &--active {
@ -160,6 +167,11 @@
> .md-nav__list > .md-nav__item { > .md-nav__list > .md-nav__item {
padding-left: 0; padding-left: 0;
} }
// Hide titles from 2nd level on
.md-nav .md-nav__title {
display: none;
}
} }
} }
} }