Skip to content

Commit 405dfce

Browse files
committed
Improve support for instant loading with keyboard navigation
1 parent ea9446e commit 405dfce

File tree

9 files changed

+35
-29
lines changed

9 files changed

+35
-29
lines changed

material/assets/javascripts/bundle.220ee61c.min.js.map

Lines changed: 0 additions & 8 deletions
This file was deleted.

material/assets/javascripts/bundle.220ee61c.min.js renamed to material/assets/javascripts/bundle.7825f8c2.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/assets/javascripts/bundle.7825f8c2.min.js.map

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
</script>
241241
{% endblock %}
242242
{% block scripts %}
243-
<script src="{{ 'assets/javascripts/bundle.220ee61c.min.js' | url }}"></script>
243+
<script src="{{ 'assets/javascripts/bundle.7825f8c2.min.js' | url }}"></script>
244244
{% for script in config.extra_javascript %}
245245
{% if script.path %}
246246
{{ script | script_tag }}

material/partials/footer.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<nav class="md-footer__inner md-grid" aria-label="{{ lang.t('footer') }}" {{ hidden }}>
1111
{% if page.previous_page %}
1212
{% set direction = lang.t("footer.previous") %}
13-
<a href="{{ page.previous_page.url | url }}" class="md-footer__link md-footer__link--prev" aria-label="{{ direction }}: {{ page.previous_page.title | e }}" rel="prev">
13+
<a href="{{ page.previous_page.url | url }}" class="md-footer__link md-footer__link--prev" aria-label="{{ direction }}: {{ page.previous_page.title | e }}">
1414
<div class="md-footer__button md-icon">
1515
{% include ".icons/material/arrow-left.svg" %}
1616
</div>
@@ -26,7 +26,7 @@
2626
{% endif %}
2727
{% if page.next_page %}
2828
{% set direction = lang.t("footer.next") %}
29-
<a href="{{ page.next_page.url | url }}" class="md-footer__link md-footer__link--next" aria-label="{{ direction }}: {{ page.next_page.title | e }}" rel="next">
29+
<a href="{{ page.next_page.url | url }}" class="md-footer__link md-footer__link--next" aria-label="{{ direction }}: {{ page.next_page.title | e }}">
3030
<div class="md-footer__title">
3131
<span class="md-footer__direction">
3232
{{ direction }}

material/partials/languages/sa.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@
3333
"rss.updated": "आरएसएस सेवातः नवीनतमं अद्यतनम्",
3434
"search": "अन्वेषण",
3535
"search.placeholder": "अन्वेषण",
36-
"search.share": "साझां कुर्वन्तु",
36+
"search.share": "भजतु",
3737
"search.reset": "तत् स्वच्छं कुर्वन्तु",
3838
"search.result.initializer": "अन्वेषणस्य आरम्भः",
3939
"search.result.placeholder": "अन्वेषणं आरभ्य लिखन्तु",
40-
"search.result.none": "मेलयुक्ताः दस्तावेजाः नास्ति",
41-
"search.result.one": "१ मेलकर्ता दस्तावेजः अस्ति",
42-
"search.result.other": "# मेलनदस्तावेजाः सन्ति",
43-
"search.result.more.one": "अस्मिन् पृष्ठे १ अधिकं अस्ति",
44-
"search.result.more.other": "अस्मिन् पृष्ठे # अधिकाः सन्ति",
45-
"search.result.term.missing": "असमेत",
40+
"search.result.none": "अभिलेखाः नास्ति",
41+
"search.result.one": "१ अभिलेखः अस्ति",
42+
"search.result.other": "# अभिलेखाः सन्ति",
43+
"search.result.more.one": "अस्मिन् पृष्ठे १ अन्यः अस्ति",
44+
"search.result.more.other": "अस्मिन् पृष्ठे # अन्ये सन्ति",
45+
"search.result.term.missing": "शून्य",
4646
"select.language": "भाषां चिनोतु",
4747
"select.version": "संस्करणं चिनोतु",
4848
"source": "भण्डारं गच्छन्तु",
4949
"source.file.contributors": "अंशदाता",
5050
"source.file.date.created": "ननिर्माणस्य तिथिः",
5151
"source.file.date.updated": "परिवर्तनस्य तिथिः",
52-
"tabs": "दस्तावेजस्य प्रमुखः",
52+
"tabs": "पट्टाः",
5353
"toc": "सामग्रीसारणी",
5454
"top": "पुनः उपरिभागं प्रति गच्छन्तु"
5555
}[key] }}{% endmacro %}

src/assets/javascripts/bundle.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,21 @@ keyboard$
178178
case ",":
179179
const prev = getOptionalElement<HTMLLinkElement>("link[rel=prev]")
180180
if (typeof prev !== "undefined")
181-
setLocation(prev)
181+
if (feature("navigation.instant"))
182+
location$.next(new URL(prev.href))
183+
else
184+
setLocation(prev)
182185
break
183186

184187
/* Go to next page */
185188
case "n":
186189
case ".":
187190
const next = getOptionalElement<HTMLLinkElement>("link[rel=next]")
188191
if (typeof next !== "undefined")
189-
setLocation(next)
192+
if (feature("navigation.instant"))
193+
location$.next(new URL(next.href))
194+
else
195+
setLocation(next)
190196
break
191197

192198
/* Expand navigation, see https://bit.ly/3ZjG5io */

src/assets/javascripts/integrations/instant/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ export function setupInstantLoading(
227227

228228
// Meta tags
229229
"title",
230+
"link[rel=prev]",
231+
"link[rel=next]",
230232
"link[rel=canonical]",
231233
"meta[name=author]",
232234
"meta[name=description]",

src/partials/footer.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
href="{{ page.previous_page.url | url }}"
4343
class="md-footer__link md-footer__link--prev"
4444
aria-label="{{ direction }}: {{ page.previous_page.title | e }}"
45-
rel="prev"
4645
>
4746
<div class="md-footer__button md-icon">
4847
{% include ".icons/material/arrow-left.svg" %}
@@ -65,7 +64,6 @@
6564
href="{{ page.next_page.url | url }}"
6665
class="md-footer__link md-footer__link--next"
6766
aria-label="{{ direction }}: {{ page.next_page.title | e }}"
68-
rel="next"
6967
>
7068
<div class="md-footer__title">
7169
<span class="md-footer__direction">

0 commit comments

Comments
 (0)