Skip to content

Commit 3dd5916

Browse files
authored
Fix back button tab switch. (#1003)
1 parent 6f052ca commit 3dd5916

19 files changed

+9271
-7221
lines changed

app/test/frontend/golden/authorized_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/error_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/flutter_landing_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/index_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/pkg_index_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/pkg_show_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/pkg_show_page_deprecated.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/pkg_show_page_flutter_plugin.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/pkg_show_page_outdated.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/pkg_show_version_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
2121
<link href="/static/highlight/github.css" rel="stylesheet" />
2222
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
23-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
23+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2424
<script>
2525
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2626
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/pkg_versions_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
2121
<link href="/static/highlight/github.css" rel="stylesheet" />
2222
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
23-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
23+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2424
<script>
2525
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2626
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/search_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/search_supported_qualifier.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/search_unsupported_qualifier.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

app/test/frontend/golden/web_landing_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
2020
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
21-
<script src="/static/js/script.dart.js?hash=1mdhgmfm490300v0h9lp3d23q52dlicd" defer></script>
21+
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2424
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

static/js/script.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,16 @@ void _setEventForMobileNav() {
118118
});
119119
}
120120

121+
/// change the tab based on URL hash
121122
void _changeTabOnUrlHash() {
122-
// change the tab based on URL hash
123-
if (tabRoot != null && (window.location.hash ?? '').isNotEmpty) {
124-
_changeTab(window.location.hash.substring(1));
123+
if (tabRoot == null) return;
124+
final hash = window.location.hash ?? '';
125+
// Navigating back to a non-hashed package page will result an empty hash.
126+
// Displaying the default tab: readme.
127+
if (hash.isEmpty) {
128+
_changeTab('-readme-tab-');
129+
} else {
130+
_changeTab(hash.substring(1));
125131
}
126132
}
127133

0 commit comments

Comments
 (0)