mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-11-02 20:33:42 +00:00
Merge pull request #1523 from CyC2018/site-reader
Update site accessibility
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
:root { --theme-color: #2a7a5a; }
|
||||
body, .sidebar, .sidebar-toggle { background: #f3f2ee; }
|
||||
/* 载入提示:vue.css 的 div#app { margin: 40vh auto } 会穿透到 body,载入完成时整页从屏幕中间跳到顶部 */
|
||||
div#app { display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; color: #718078; font-size: 14px; letter-spacing: .04em; }
|
||||
div#app { display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; color: #5f6d66; font-size: 14px; letter-spacing: .04em; }
|
||||
/* 载入完成前 body 不能滚动,出现滚动条时页面会左移;预留滚动条的位置 */
|
||||
html { scrollbar-gutter: stable; }
|
||||
body { color: #34495e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
|
||||
@@ -11,7 +11,7 @@ body { color: #34495e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI
|
||||
.search input { background: #fff !important; border-radius: 6px; }
|
||||
.sidebar-nav > ul { padding-left: 18px; }
|
||||
.sidebar ul li { margin: 7px 0; }
|
||||
.sidebar ul li strong { font-size: 13px; letter-spacing: .08em; color: #718078; }
|
||||
.sidebar ul li strong { font-size: 13px; letter-spacing: .08em; color: #5f6d66; }
|
||||
.sidebar ul li a { font-size: 14px; }
|
||||
.markdown-section { max-width: 960px; padding: 36px 48px 100px; }
|
||||
.markdown-section h1 { margin: 1rem 0 2rem; font-size: 2rem; }
|
||||
@@ -34,12 +34,12 @@ body { color: #34495e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI
|
||||
.site-search { padding: 8px 15px; }
|
||||
.site-search input { box-sizing: border-box; width: 100%; min-height: 42px; padding: 10px; border: 1px solid #dfe3da; color: #34495e; font-size: 15px; }
|
||||
.site-search input:focus { outline: 2px solid #2a7a5a; outline-offset: 1px; }
|
||||
.search-status { color: #718078; font-size: 12px; margin: 7px 0; }
|
||||
.search-status { color: #5f6d66; font-size: 12px; margin: 7px 0; }
|
||||
.search-status:empty { display: none; }
|
||||
.site-search .matching-post { display: block; padding: 12px 0; border-bottom: 1px solid #dde3d8; text-decoration: none; }
|
||||
.matching-post strong, .matching-post small { display: block; }
|
||||
.matching-post strong { color: #2a7a5a; font-size: 14px; }
|
||||
.matching-post small { color: #718078; margin: 5px 0; font-size: 12px; }
|
||||
.matching-post small { color: #5f6d66; margin: 5px 0; font-size: 12px; }
|
||||
.matching-post p { color: #34495e; margin: 4px 0; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
|
||||
.article-toc { border: 1px solid #dfe3da; border-radius: 7px; padding: 12px 18px; margin: 20px 0 28px; background: #fafbf8; }
|
||||
.article-toc summary { color: #2a7a5a; font-weight: 600; cursor: pointer; min-height: 24px; }
|
||||
@@ -95,7 +95,7 @@ body { color: #34495e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI
|
||||
.anim-bar { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 6px 0 4px; }
|
||||
.anim-bar button { min-height: 30px; padding: 2px 12px; border: 1px solid #dfe3da; border-radius: 6px; background: #fafbf8; color: #34495e; font: inherit; font-size: 13px; cursor: pointer; }
|
||||
.anim-bar button:hover, .anim-bar button:focus-visible { border-color: #2a7a5a; color: #2a7a5a; }
|
||||
.anim-count { min-width: 44px; color: #718078; font-size: 12px; font-variant-numeric: tabular-nums; }
|
||||
.anim-count { min-width: 44px; color: #5f6d66; font-size: 12px; font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* 代码高亮:在 #f8f8f8 底上对比度不低于 4.5:1 */
|
||||
.markdown-section code { color: #9a3f2a; }
|
||||
@@ -143,3 +143,4 @@ body { color: #34495e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI
|
||||
.markdown-section table { display: table; }
|
||||
.markdown-section tr { break-inside: avoid; }
|
||||
}
|
||||
.markdown-section pre > code[tabindex]:focus-visible, .markdown-section table[tabindex]:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
|
||||
|
||||
@@ -57,6 +57,17 @@
|
||||
if (toggle) { toggle.setAttribute('aria-label', '打开或收起目录'); toggle.title = '目录'; }
|
||||
var corner = document.querySelector('.github-corner');
|
||||
if (corner) corner.setAttribute('aria-label', '在 GitHub 上查看源码');
|
||||
// 角标放进导航地标,读屏软件按地标浏览时不会漏掉它
|
||||
if (corner && !corner.closest('nav, header, aside, main, footer')) {
|
||||
var nav = document.createElement('nav');
|
||||
nav.setAttribute('aria-label', '源码仓库');
|
||||
corner.parentNode.insertBefore(nav, corner);
|
||||
nav.appendChild(corner);
|
||||
}
|
||||
// 比页面宽的代码块和表格需要横向滚动,加入 Tab 顺序后可以用方向键滚动
|
||||
document.querySelectorAll('.markdown-section pre > code, .markdown-section table').forEach(function (box) {
|
||||
if (box.scrollWidth > box.clientWidth) box.tabIndex = 0;
|
||||
});
|
||||
}
|
||||
function skipLink() {
|
||||
if (document.querySelector('.skip-link')) return;
|
||||
|
||||
Reference in New Issue
Block a user