mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-25 01:57:04 +00:00
fix(website): smooth anchor scrolling, language-switch scroll position, lang select UX
- Replace JS scrollIntoView handler with CSS scroll-behavior:smooth for native anchor navigation. Fixes #hash-based scroll position surviving language switches since the hash stays in the URL. - Auto-update URL hash via IntersectionObserver as user scrolls through sections, so manual scrolling also sets the anchor for language switch. - Preserve window.location.hash across all language-switch navigations. - Fix Chrome double-arrow on language select by limiting appearance:base-select to ::picker(select) only, keeping the custom SVG chevron. - Make chevron absolutely positioned over the select with pointer-events:none so clicks anywhere on the container open the dropdown. - Remove max-width constraint on language select so longer names fit. - Add scroll-margin-top to section[id] and header[id] so anchored sections clear the fixed navbar (100px offset). - Add header[id] to scroll-margin-top for keyboard skip-link accessibility. Thanks to Taradal from Reddit
This commit is contained in:
+13
-10
@@ -61,6 +61,10 @@
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Twemoji Country Flags', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
||||
background-color: var(--bg);
|
||||
@@ -2007,12 +2011,14 @@ html:not(.lang-de) [lang="de"] {
|
||||
}
|
||||
|
||||
.lang-select-container .chevron-icon {
|
||||
position: absolute;
|
||||
right: 14px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
flex-shrink: 0;
|
||||
pointer-events: none;
|
||||
opacity: 0.6;
|
||||
margin-left: -2px;
|
||||
}
|
||||
|
||||
.lang-select-container:hover .chevron-icon {
|
||||
@@ -2031,21 +2037,16 @@ html:not(.lang-de) [lang="de"] {
|
||||
font-weight: 600;
|
||||
color: currentColor;
|
||||
cursor: pointer;
|
||||
padding: 0 12px 0 0;
|
||||
padding: 0 28px 0 0;
|
||||
margin: 0;
|
||||
width: auto;
|
||||
max-width: 150px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 110px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@supports (appearance: base-select) {
|
||||
.lang-dropdown,
|
||||
.lang-dropdown::picker(select) {
|
||||
appearance: base-select;
|
||||
}
|
||||
.lang-dropdown::picker(select) {
|
||||
background-color: #0f172a;
|
||||
border: 1px solid #334155;
|
||||
border-radius: 8px;
|
||||
@@ -2748,7 +2749,9 @@ html:not(.lang-de) [lang="de"] {
|
||||
}
|
||||
.feature-card,
|
||||
.use-case-card,
|
||||
.compat-logo {
|
||||
.compat-logo,
|
||||
section[id],
|
||||
header[id] {
|
||||
scroll-margin-top: 100px;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user