Skip to content

Commit bba03e4

Browse files
WIP: no-history feature
1 parent bc7f84a commit bba03e4

File tree

11 files changed

+185
-7
lines changed

11 files changed

+185
-7
lines changed

.idea/.gitignore

Whitespace-only changes.

.idea/inspectionProfiles/Project_Default.xml

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

.idea/misc.xml

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

.idea/modules.xml

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

.idea/vcf-anchor-nav.iml

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

.idea/vcs.xml

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

.idea/workspace.xml

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

demo/foo.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="utf-8" />
4+
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes" />
5+
<title>vcf-anchor-nav demo</title>
6+
</head>
7+
<body>
8+
<p>Foo <a href="./index.html">Go back</a></p>
9+
10+
</body>

demo/index.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@
157157
</custom-style>
158158
</head>
159159
<body>
160-
<vcf-anchor-nav fullscreen class="main hidden">
160+
161+
<vcf-anchor-nav fullscreen class="main hidden" no-history>
162+
<p>Go to <a href="./foo.html">foo</a></p>
161163
<a id="api" slot="header" href="/api/#/elements/Vaadin.VcfAnchorNav">
162164
<vaadin-button theme="tertiary" class="nav-btn">
163165
<iron-icon icon="lumo:angle-right" slot="suffix"></iron-icon>
@@ -194,7 +196,7 @@ <h2 slot="header" class="main">Basic</h2>
194196
}
195197
</style>
196198

197-
<vcf-anchor-nav id="basic" theme="expand-last" disable-preserve-on-refresh>
199+
<vcf-anchor-nav id="basic" theme="expand-last" disable-preserve-on-refresh no-history>
198200
<h1 slot="header">Main Header</h1>
199201

200202
<vcf-anchor-nav-section name="Introduction">
@@ -256,7 +258,7 @@ <h2 slot="header" class="main">Fullscreen</h2>
256258
}
257259
</style>
258260

259-
<vcf-anchor-nav id="fullscreen" theme="expand-last" disable-preserve-on-refresh>
261+
<vcf-anchor-nav id="fullscreen" theme="expand-last" disable-preserve-on-refresh no-history>
260262
<vaadin-button slot="header">Toggle Fullscreen</vaadin-button>
261263
<vcf-anchor-nav-section>Section 1</vcf-anchor-nav-section>
262264
<vcf-anchor-nav-section>Section 2</vcf-anchor-nav-section>
@@ -313,7 +315,7 @@ <h2 slot="header" class="main">Custom Tabs</h2>
313315
}
314316
</style>
315317

316-
<vcf-anchor-nav id="custom-tabs" theme="expand-last" disable-preserve-on-refresh>
318+
<vcf-anchor-nav id="custom-tabs" theme="expand-last" disable-preserve-on-refresh no-history>
317319
<!-- Add your own <vaadin-tabs> to the "tabs" slot. -->
318320
<vaadin-tabs slot="tabs">
319321
<!-- Create custom <vaadin-tab> with "id" equal to "tab-id" of the linked section. -->

src/vcf-anchor-nav-section.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class AnchorNavSectionElement extends ElementMixin(ThemableMixin(PolymerElement)
137137
}
138138

139139
get navTab() {
140-
return this.nav && this.nav.$.tabs.querySelector(`#${this.tabId || this.defaultTabId}`);
140+
return this.nav && this.nav.$ && this.nav.$.tabs && this.nav.$.tabs.querySelector(`#${this.tabId || this.defaultTabId}`);
141141
}
142142

143143
get url() {
@@ -175,7 +175,7 @@ class AnchorNavSectionElement extends ElementMixin(ThemableMixin(PolymerElement)
175175

176176
_onTabSlotChange() {
177177
const tab = this.tab;
178-
if (this.nav && tab) {
178+
if (this.nav && this.nav.$ && tab) {
179179
tab.removeAttribute('slot');
180180
this.tabId = tab.id;
181181
this.nav.$.tabs.appendChild(tab);

0 commit comments

Comments
 (0)