From 36cd3fdca4c3302c29373cc9ac5d8d9663f668bb Mon Sep 17 00:00:00 2001 From: dethan3 Date: Fri, 20 Nov 2026 16:03:34 +0800 Subject: [PATCH 1/4] fix(navbar): unify styling and improve dropdown interactions Use shared dark-theme colors for links and dropdown triggers while preserving hover, keyboard focus, and current-page feedback. Open dropdowns on desktop mouse hover, retain touch click toggling, and bridge the trigger-to-menu gap. Center menus on their triggers with viewport and mobile drawer edge avoidance through Idea React positioning. Render desktop navigation outside a dialog to prevent automatic focus on About after refresh, while retaining the mobile drawer and keyboard focus restoration. Validated Simplified Chinese and English navigation with mouse, keyboard, mobile touch, and mixed-input simulations. TypeScript, ESLint, formatting, and production build checks passed. --- components/Navigator/MainNavigator.module.css | 64 +++++++++ components/Navigator/MainNavigator.tsx | 38 +++--- components/Navigator/MainNavigatorDrawer.tsx | 39 ++++++ components/Navigator/MainNavigatorMenu.tsx | 122 ++++++++++++++++++ 4 files changed, 240 insertions(+), 23 deletions(-) create mode 100644 components/Navigator/MainNavigator.module.css create mode 100644 components/Navigator/MainNavigatorDrawer.tsx create mode 100644 components/Navigator/MainNavigatorMenu.tsx diff --git a/components/Navigator/MainNavigator.module.css b/components/Navigator/MainNavigator.module.css new file mode 100644 index 0000000..eb63115 --- /dev/null +++ b/components/Navigator/MainNavigator.module.css @@ -0,0 +1,64 @@ +.link { + color: var(--bs-nav-link-color); + white-space: nowrap; +} + +.link:hover, +.link:focus-visible, +.link[aria-expanded='true'] { + color: var(--bs-nav-link-hover-color); +} + +.link[aria-current] { + color: var(--bs-nav-link-active-color); + font-weight: var(--bs-font-weight-bold); +} + +.link:focus-visible, +.menuItem:focus-visible { + outline: 2px solid currentColor; + outline-offset: -2px; +} + +.menu { + --bs-menu-bg: var(--bs-bg-body); + --bs-menu-border-color: var(--bs-border-color-translucent); + --bs-menu-color: var(--bs-fg-body); + --bs-menu-item-hover-bg: var(--bs-bg-1); + --bs-menu-item-active-bg: var(--bs-bg-2); + --bs-menu-item-active-color: var(--bs-fg-body); + transform-origin: top center; +} + +.menu[data-bs-placement^='top'] { + transform-origin: bottom center; +} + +/* Keep the four-pixel visual gap within the menu's pointer hit area. */ +.menu::before { + position: absolute; + inset-inline: 0; + top: -5px; + height: 5px; + content: ''; +} + +.menu[data-bs-placement^='top']::before { + top: auto; + bottom: -5px; +} + +.menuItem { + color: var(--bs-menu-item-color); + white-space: normal; + overflow-wrap: anywhere; +} + +.menuItem:hover, +.menuItem:focus-visible { + color: var(--bs-menu-item-hover-color); +} + +.menuItem[aria-current] { + color: var(--bs-menu-item-active-color); +} diff --git a/components/Navigator/MainNavigator.tsx b/components/Navigator/MainNavigator.tsx index a09262c..c6f4722 100644 --- a/components/Navigator/MainNavigator.tsx +++ b/components/Navigator/MainNavigator.tsx @@ -1,9 +1,6 @@ import { Container, - Drawer, Image, - Menu, - MenuItem, Navbar, NavbarBrand, NavbarNav, @@ -19,6 +16,9 @@ import { AnchorHTMLAttributes, Component } from 'react'; import { DefaultImage } from '../../models/configuration'; import { i18n, I18nContext } from '../../models/Translation'; +import styles from './MainNavigator.module.css'; +import { MainNavigatorDrawer } from './MainNavigatorDrawer'; +import { MainNavigatorMenu } from './MainNavigatorMenu'; import { SearchBar } from './SearchBar'; const LanguageMenu = dynamic(() => import('./LanguageMenu'), { ssr: false }); @@ -135,37 +135,29 @@ export class MainNavigator extends Component { aria-label={t('toggle_navigation')} onClick={this.toggle} /> - - {menu.map(({ href, title, subs }) => + {menu.map(({ href, title, subs }, index) => subs ? ( - - {subs.map( - ({ href: subHref, title: subTitle }) => - subHref && ( - - {subTitle} - - ), - )} - + ) : ( href && ( {title} @@ -180,7 +172,7 @@ export class MainNavigator extends Component { - + ); diff --git a/components/Navigator/MainNavigatorDrawer.tsx b/components/Navigator/MainNavigatorDrawer.tsx new file mode 100644 index 0000000..7ab5983 --- /dev/null +++ b/components/Navigator/MainNavigatorDrawer.tsx @@ -0,0 +1,39 @@ +import { Drawer, DrawerProps } from 'idea-react'; +import { action, observable } from 'mobx'; +import { observer } from 'mobx-react'; +import { Component } from 'react'; + +type MainNavigatorDrawerProps = Pick; + +@observer +export class MainNavigatorDrawer extends Component { + @observable accessor desktop = false; + + media?: MediaQueryList; + + componentDidMount() { + this.media = window.matchMedia('(min-width: 1024px)'); + this.media.addEventListener('change', this.updateLayout); + this.updateLayout(); + } + + componentWillUnmount() { + this.media?.removeEventListener('change', this.updateLayout); + } + + @action + updateLayout = () => (this.desktop = this.media?.matches ?? false); + + render() { + const { children, ...props } = this.props; + + // A permanent desktop navigation must not run native dialog autofocus. + if (this.desktop) return
{children}
; + + return ( + + {children} + + ); + } +} diff --git a/components/Navigator/MainNavigatorMenu.tsx b/components/Navigator/MainNavigatorMenu.tsx new file mode 100644 index 0000000..0f83113 --- /dev/null +++ b/components/Navigator/MainNavigatorMenu.tsx @@ -0,0 +1,122 @@ +import { Menu, MenuItem } from 'idea-react'; +import { action, observable } from 'mobx'; +import { observer } from 'mobx-react'; +import { Component, createRef, PointerEvent } from 'react'; + +import type { NavigatorMenuItem } from './MainNavigator'; +import styles from './MainNavigator.module.css'; + +interface MainNavigatorMenuProps { + id: string; + title: NavigatorMenuItem['title']; + items: NavigatorMenuItem[]; + pathname: string; + onSelect: () => void; +} + +const canHover = ({ pointerType }: PointerEvent) => + pointerType === 'mouse' && + window.matchMedia('(min-width: 1024px) and (any-hover: hover) and (any-pointer: fine)').matches; + +@observer +export class MainNavigatorMenu extends Component { + @observable accessor horizontalOffset = 0; + @observable accessor viewportPadding = 8; + + menu = createRef>(); + closeTimer?: ReturnType; + resize?: ResizeObserver; + + componentDidMount() { + const { trigger, panel } = this.menu.current ?? {}; + if (!trigger?.current || !panel?.current) return; + + this.resize = new ResizeObserver(this.centerMenu); + this.resize.observe(trigger.current); + this.resize.observe(panel.current); + window.addEventListener('resize', this.centerMenu); + } + + componentWillUnmount() { + this.cancelClose(); + this.resize?.disconnect(); + window.removeEventListener('resize', this.centerMenu); + } + + @action + centerMenu = () => { + const { trigger, panel } = this.menu.current ?? {}; + if (!trigger?.current || !panel?.current || panel.current.hidden) return; + + // Shift start alignment to the center; Menu still clamps it to the viewport. + this.horizontalOffset = (trigger.current.offsetWidth - panel.current.offsetWidth) / 2; + + // A mobile modal drawer clips content inside its inset viewport edges. + const drawer = panel.current.closest('dialog:modal')?.getBoundingClientRect(); + this.viewportPadding = drawer + ? Math.max(8, Math.ceil(drawer.left) + 8, Math.ceil(window.innerWidth - drawer.right) + 8) + : 8; + }; + + cancelClose = () => { + clearTimeout(this.closeTimer); + this.closeTimer = undefined; + }; + + handlePointerEnter = (event: PointerEvent) => { + this.cancelClose(); + if (canHover(event)) this.menu.current?.setOpen(true); + }; + + handlePointerLeave = (event: PointerEvent) => { + if (!canHover(event)) return; + + this.cancelClose(); + // Allow diagonal movement into a menu shifted away from the viewport edge. + this.closeTimer = setTimeout(() => this.menu.current?.setOpen(false), 200); + }; + + render() { + const { id, title, items, pathname, onSelect } = this.props; + const active = items.some(({ href }) => href === pathname); + + return ( + + {items.map( + ({ href, title }) => + href && ( + + {title} + + ), + )} + + ); + } +} From 58e8f31cd0587fecc33a43af15bf24e1d7fd0c38 Mon Sep 17 00:00:00 2001 From: dethan3 Date: Fri, 20 Nov 2026 16:27:40 +0800 Subject: [PATCH 2/4] fix(navbar): follow upstream markup and connect drawer controls Wrap each dropdown Menu in NavItem and restore its default div root to match Bootstrap 6 and Idea React navbar examples without nesting list items. Connect NavbarToggler aria-controls to a stable navigation ID shared by the desktop container and mobile drawer across breakpoint changes. Desktop hover opening and trigger-centered menus with edge avoidance are intentional UX customizations requested for this site. Bootstrap deliberately uses click-to-open menus; this change does not treat that upstream default as a bug. Touch clicking and keyboard focus behavior remain supported. --- components/Navigator/MainNavigator.tsx | 20 +++++++++++------- components/Navigator/MainNavigatorDrawer.tsx | 22 ++++++++++++++++---- components/Navigator/MainNavigatorMenu.tsx | 4 ++-- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/components/Navigator/MainNavigator.tsx b/components/Navigator/MainNavigator.tsx index c6f4722..311a955 100644 --- a/components/Navigator/MainNavigator.tsx +++ b/components/Navigator/MainNavigator.tsx @@ -22,6 +22,7 @@ import { MainNavigatorMenu } from './MainNavigatorMenu'; import { SearchBar } from './SearchBar'; const LanguageMenu = dynamic(() => import('./LanguageMenu'), { ssr: false }); +const NAVIGATION_ID = 'main-navigation'; export interface NavigatorMenuItem extends Pick< AnchorHTMLAttributes, @@ -132,10 +133,12 @@ export class MainNavigator extends Component { { {menu.map(({ href, title, subs }, index) => subs ? ( - + + + ) : ( href && ( diff --git a/components/Navigator/MainNavigatorDrawer.tsx b/components/Navigator/MainNavigatorDrawer.tsx index 7ab5983..975f779 100644 --- a/components/Navigator/MainNavigatorDrawer.tsx +++ b/components/Navigator/MainNavigatorDrawer.tsx @@ -3,7 +3,10 @@ import { action, observable } from 'mobx'; import { observer } from 'mobx-react'; import { Component } from 'react'; -type MainNavigatorDrawerProps = Pick; +type MainNavigatorDrawerProps = Pick< + DrawerProps, + 'id' | 'title' | 'open' | 'onDismiss' | 'children' +>; @observer export class MainNavigatorDrawer extends Component { @@ -25,13 +28,24 @@ export class MainNavigatorDrawer extends Component { updateLayout = () => (this.desktop = this.media?.matches ?? false); render() { - const { children, ...props } = this.props; + const { id, children, ...props } = this.props; // A permanent desktop navigation must not run native dialog autofocus. - if (this.desktop) return
{children}
; + if (this.desktop) + return ( +
+ {children} +
+ ); return ( - + {children} ); diff --git a/components/Navigator/MainNavigatorMenu.tsx b/components/Navigator/MainNavigatorMenu.tsx index 0f83113..e6e304b 100644 --- a/components/Navigator/MainNavigatorMenu.tsx +++ b/components/Navigator/MainNavigatorMenu.tsx @@ -14,6 +14,7 @@ interface MainNavigatorMenuProps { onSelect: () => void; } +// Deliberate UX customization: upstream menus open on click rather than hover. const canHover = ({ pointerType }: PointerEvent) => pointerType === 'mouse' && window.matchMedia('(min-width: 1024px) and (any-hover: hover) and (any-pointer: fine)').matches; @@ -23,7 +24,7 @@ export class MainNavigatorMenu extends Component { @observable accessor horizontalOffset = 0; @observable accessor viewportPadding = 8; - menu = createRef>(); + menu = createRef(); closeTimer?: ReturnType; resize?: ResizeObserver; @@ -83,7 +84,6 @@ export class MainNavigatorMenu extends Component { return ( Date: Sat, 21 Nov 2026 15:24:03 +0900 Subject: [PATCH 3/4] fix(navbar): upgrade Idea React and simplify dropdown customizations Keep desktop hover and center alignment on top of the upstream menu. Render the mobile drawer directly in MainNavigator and keep its menus in flow. --- components/Navigator/MainNavigator.module.css | 19 ++- components/Navigator/MainNavigator.tsx | 117 ++++++++++++------ components/Navigator/MainNavigatorDrawer.tsx | 53 -------- components/Navigator/MainNavigatorMenu.tsx | 43 +++---- package.json | 2 +- pages/_document.tsx | 2 +- pnpm-lock.yaml | 53 ++++---- 7 files changed, 132 insertions(+), 157 deletions(-) delete mode 100644 components/Navigator/MainNavigatorDrawer.tsx diff --git a/components/Navigator/MainNavigator.module.css b/components/Navigator/MainNavigator.module.css index eb63115..e9cf352 100644 --- a/components/Navigator/MainNavigator.module.css +++ b/components/Navigator/MainNavigator.module.css @@ -1,6 +1,5 @@ .link { color: var(--bs-nav-link-color); - white-space: nowrap; } .link:hover, @@ -20,13 +19,13 @@ outline-offset: -2px; } -.menu { - --bs-menu-bg: var(--bs-bg-body); - --bs-menu-border-color: var(--bs-border-color-translucent); - --bs-menu-color: var(--bs-fg-body); - --bs-menu-item-hover-bg: var(--bs-bg-1); +.menu, +.inlineMenu { --bs-menu-item-active-bg: var(--bs-bg-2); --bs-menu-item-active-color: var(--bs-fg-body); +} + +.menu { transform-origin: top center; } @@ -48,6 +47,14 @@ bottom: -5px; } +/* Keep submenus inside the scrollable drawer instead of positioning them in the viewport. */ +.inlineMenu { + position: static !important; + min-width: 0; + max-width: 100% !important; + max-height: none !important; +} + .menuItem { color: var(--bs-menu-item-color); white-space: normal; diff --git a/components/Navigator/MainNavigator.tsx b/components/Navigator/MainNavigator.tsx index 311a955..c9d18ba 100644 --- a/components/Navigator/MainNavigator.tsx +++ b/components/Navigator/MainNavigator.tsx @@ -1,5 +1,6 @@ import { Container, + Drawer, Image, Navbar, NavbarBrand, @@ -17,12 +18,12 @@ import { AnchorHTMLAttributes, Component } from 'react'; import { DefaultImage } from '../../models/configuration'; import { i18n, I18nContext } from '../../models/Translation'; import styles from './MainNavigator.module.css'; -import { MainNavigatorDrawer } from './MainNavigatorDrawer'; import { MainNavigatorMenu } from './MainNavigatorMenu'; import { SearchBar } from './SearchBar'; const LanguageMenu = dynamic(() => import('./LanguageMenu'), { ssr: false }); const NAVIGATION_ID = 'main-navigation'; +const DESKTOP_QUERY = '(min-width: 1024px)'; export interface NavigatorMenuItem extends Pick< AnchorHTMLAttributes, @@ -116,6 +117,26 @@ export class MainNavigator extends Component { @observable accessor open = false; + @observable accessor desktop = false; + + desktopMedia?: MediaQueryList; + + componentDidMount() { + this.desktopMedia = window.matchMedia(DESKTOP_QUERY); + this.desktopMedia.addEventListener('change', this.updateLayout); + this.updateLayout(); + } + + componentWillUnmount() { + this.desktopMedia?.removeEventListener('change', this.updateLayout); + } + + @action + updateLayout = () => { + this.desktop = this.desktopMedia?.matches ?? false; + if (this.desktop) this.hide(); + }; + toggle = action(() => (this.open = !this.open)); hide = action(() => (this.open = false)); @@ -124,6 +145,45 @@ export class MainNavigator extends Component { const { t } = this.context; const menu = this.props.menu ?? topNavBarMenu(this.context); + const navigation = ( + <> + + {menu.map(({ href, title, subs }, index) => + subs ? ( + + + + ) : ( + href && ( + + + {title} + + + ) + ), + )} + + +
+ + +
+ + ); + return ( @@ -137,46 +197,23 @@ export class MainNavigator extends Component { aria-label={t('toggle_navigation')} onClick={this.toggle} /> - - - {menu.map(({ href, title, subs }, index) => - subs ? ( - - - - ) : ( - href && ( - - - {title} - - - ) - ), - )} - - -
- - + {this.desktop ? ( +
+ {navigation}
- + ) : ( + + {navigation} + + )} ); diff --git a/components/Navigator/MainNavigatorDrawer.tsx b/components/Navigator/MainNavigatorDrawer.tsx deleted file mode 100644 index 975f779..0000000 --- a/components/Navigator/MainNavigatorDrawer.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { Drawer, DrawerProps } from 'idea-react'; -import { action, observable } from 'mobx'; -import { observer } from 'mobx-react'; -import { Component } from 'react'; - -type MainNavigatorDrawerProps = Pick< - DrawerProps, - 'id' | 'title' | 'open' | 'onDismiss' | 'children' ->; - -@observer -export class MainNavigatorDrawer extends Component { - @observable accessor desktop = false; - - media?: MediaQueryList; - - componentDidMount() { - this.media = window.matchMedia('(min-width: 1024px)'); - this.media.addEventListener('change', this.updateLayout); - this.updateLayout(); - } - - componentWillUnmount() { - this.media?.removeEventListener('change', this.updateLayout); - } - - @action - updateLayout = () => (this.desktop = this.media?.matches ?? false); - - render() { - const { id, children, ...props } = this.props; - - // A permanent desktop navigation must not run native dialog autofocus. - if (this.desktop) - return ( -
- {children} -
- ); - - return ( - - {children} - - ); - } -} diff --git a/components/Navigator/MainNavigatorMenu.tsx b/components/Navigator/MainNavigatorMenu.tsx index e6e304b..f5015ec 100644 --- a/components/Navigator/MainNavigatorMenu.tsx +++ b/components/Navigator/MainNavigatorMenu.tsx @@ -9,20 +9,15 @@ import styles from './MainNavigator.module.css'; interface MainNavigatorMenuProps { id: string; title: NavigatorMenuItem['title']; + desktop: boolean; items: NavigatorMenuItem[]; pathname: string; onSelect: () => void; } -// Deliberate UX customization: upstream menus open on click rather than hover. -const canHover = ({ pointerType }: PointerEvent) => - pointerType === 'mouse' && - window.matchMedia('(min-width: 1024px) and (any-hover: hover) and (any-pointer: fine)').matches; - @observer export class MainNavigatorMenu extends Component { @observable accessor horizontalOffset = 0; - @observable accessor viewportPadding = 8; menu = createRef(); closeTimer?: ReturnType; @@ -30,18 +25,16 @@ export class MainNavigatorMenu extends Component { componentDidMount() { const { trigger, panel } = this.menu.current ?? {}; - if (!trigger?.current || !panel?.current) return; + if (!this.props.desktop || !trigger?.current || !panel?.current) return; this.resize = new ResizeObserver(this.centerMenu); this.resize.observe(trigger.current); this.resize.observe(panel.current); - window.addEventListener('resize', this.centerMenu); } componentWillUnmount() { this.cancelClose(); this.resize?.disconnect(); - window.removeEventListener('resize', this.centerMenu); } @action @@ -51,12 +44,6 @@ export class MainNavigatorMenu extends Component { // Shift start alignment to the center; Menu still clamps it to the viewport. this.horizontalOffset = (trigger.current.offsetWidth - panel.current.offsetWidth) / 2; - - // A mobile modal drawer clips content inside its inset viewport edges. - const drawer = panel.current.closest('dialog:modal')?.getBoundingClientRect(); - this.viewportPadding = drawer - ? Math.max(8, Math.ceil(drawer.left) + 8, Math.ceil(window.innerWidth - drawer.right) + 8) - : 8; }; cancelClose = () => { @@ -65,20 +52,25 @@ export class MainNavigatorMenu extends Component { }; handlePointerEnter = (event: PointerEvent) => { + if (event.pointerType !== 'mouse') return; + this.cancelClose(); - if (canHover(event)) this.menu.current?.setOpen(true); + this.menu.current?.setOpen(true); }; handlePointerLeave = (event: PointerEvent) => { - if (!canHover(event)) return; + if (event.pointerType !== 'mouse') return; this.cancelClose(); // Allow diagonal movement into a menu shifted away from the viewport edge. - this.closeTimer = setTimeout(() => this.menu.current?.setOpen(false), 200); + this.closeTimer = setTimeout(() => { + const menu = this.menu.current; + if (!menu?.panel.current?.contains(document.activeElement)) menu?.setOpen(false); + }, 200); }; render() { - const { id, title, items, pathname, onSelect } = this.props; + const { id, title, desktop, items, pathname, onSelect } = this.props; const active = items.some(({ href }) => href === pathname); return ( @@ -88,18 +80,15 @@ export class MainNavigatorMenu extends Component { label={title} nav theme="dark" - align="start" - placement="bottom-start" - offset={[this.horizontalOffset, 4]} - padding={this.viewportPadding} - flip - menuClassName={styles.menu} + className={desktop ? undefined : 'w-100'} + offset={desktop ? [this.horizontalOffset, 4] : undefined} + menuClassName={desktop ? styles.menu : styles.inlineMenu} toggleProps={{ className: styles.link, 'aria-current': active ? 'true' : undefined, }} - onPointerEnter={this.handlePointerEnter} - onPointerLeave={this.handlePointerLeave} + onPointerEnter={desktop ? this.handlePointerEnter : undefined} + onPointerLeave={desktop ? this.handlePointerLeave : undefined} onOpenChange={this.cancelClose} > {items.map( diff --git a/package.json b/package.json index 21d4845..260cd92 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "core-js": "^3.51.0", "echarts-jsx": "^0.6.0", "file-type": "^22.3.0", - "idea-react": "^3.0.0-rc.4", + "idea-react": "^3.0.0-rc.6", "jsonwebtoken": "^9.0.3", "koa": "^3.3.0", "koa-jwt": "^4.0.4", diff --git a/pages/_document.tsx b/pages/_document.tsx index 22ba9f1..182264a 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -38,7 +38,7 @@ export default class CustomDocument extends Document { rel="stylesheet" href="https://unpkg.com/github-markdown-css@5.9.0/github-markdown.css" /> - + =20.9.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@img/sharp-linux-arm@0.35.5': resolution: {integrity: sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==} engines: {node: '>=20.9.0'} cpu: [arm] os: [linux] - libc: [glibc] '@img/sharp-linux-ppc64@0.35.5': resolution: {integrity: sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==} engines: {node: '>=20.9.0'} cpu: [ppc64] os: [linux] - libc: [glibc] '@img/sharp-linux-riscv64@0.35.5': resolution: {integrity: sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==} engines: {node: '>=20.9.0'} cpu: [riscv64] os: [linux] - libc: [glibc] '@img/sharp-linux-s390x@0.35.5': resolution: {integrity: sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==} engines: {node: '>=20.9.0'} cpu: [s390x] os: [linux] - libc: [glibc] '@img/sharp-linux-x64@0.35.5': resolution: {integrity: sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==} engines: {node: '>=20.9.0'} cpu: [x64] os: [linux] - libc: [glibc] '@img/sharp-linuxmusl-arm64@0.35.5': resolution: {integrity: sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==} engines: {node: '>=20.9.0'} cpu: [arm64] os: [linux] - libc: [musl] '@img/sharp-linuxmusl-x64@0.35.5': resolution: {integrity: sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==} engines: {node: '>=20.9.0'} cpu: [x64] os: [linux] - libc: [musl] '@img/sharp-wasm32@0.35.5': resolution: {integrity: sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==} @@ -784,28 +770,24 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [glibc] '@next/swc-linux-arm64-musl@16.4.6': resolution: {integrity: sha512-7/qPhTxDp2ScluOJOhLuhWmlA17o1yZ0SIgpISBCpBxXgtnK4+KGywBpFkfLPiU1rnSM1faFGzYkH6i7JdTrqA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [musl] '@next/swc-linux-x64-gnu@16.4.6': resolution: {integrity: sha512-oOpbNa8XOW1qCGd9VvzC4fbkkRxEls7/WI6tz+YHC0xRA7KpV1U7DrAnCPjzVyOk/karzWEepCOcTIDmwK8FwQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [glibc] '@next/swc-linux-x64-musl@16.4.6': resolution: {integrity: sha512-aM8CZ+OR2EwXaAYw7KGkW2GDmNDsLBIRe1MMRZCJPTdw/xhTD0IMUVO4sf3KqrzuRouGzwwLZn34+gFeVXiUQA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [musl] '@next/swc-win32-arm64-msvc@16.4.6': resolution: {integrity: sha512-U0p7/tEtqvHX2crhd841CDwKtp5CFkKXVjOhmfccR3Pvp64sj8KBwRqsvltqLOwVBbj0NtkxwXSDpEHYGbxeXQ==} @@ -1927,8 +1909,8 @@ packages: idb@8.0.3: resolution: {integrity: sha512-LtwtVyVYO5BqRvcsKuB2iUMnHwPVByPCXFXOpuU96IZPPoPN6xjOGxZQ74pgSVVLQWtUOYgyeL4GE98BY5D3wg==} - idea-react@3.0.0-rc.4: - resolution: {integrity: sha512-giPY9A5x7jKwozs3d0FSb/48HLoJ8zWrjUE3veLCR+2WAqrGlkTkv0pN2R+KCWQi7AqbbmtQ/Dc7DnPEimg+wA==} + idea-react@3.0.0-rc.6: + resolution: {integrity: sha512-LXLdUkO0BJ2tSuabEEp+vZsiDIHfBD8QMgji1sbh0RHjdBH8ykfKxZOpFK3OM14KQwaPbq7OC5702FVZ9KQprA==} peerDependencies: mobx: '>=6' mobx-react: '>=9' @@ -3325,6 +3307,13 @@ packages: web-utility@4.8.2: resolution: {integrity: sha512-SbA2XIlo2UUinxIwbQ0MYhwoyXnepzMZ/bU4rR+EyEz2WcFirQtFAPNHw4+qFd4A1oi2S0ao8itHic1Vl9qlwg==} + deprecated: Don't use versions with old API & bugs + peerDependencies: + element-internals-polyfill: '>=1' + typescript: '>=4.1' + + web-utility@4.8.3: + resolution: {integrity: sha512-bckkx77G9KPHUx60YELdzf/afdfMUTMacBGDv4EkdoIt5VcqFxiY1JyzpV3fyJ5YBzkbLOi2UFzZtIct5754Bw==} peerDependencies: element-internals-polyfill: '>=1' typescript: '>=4.1' @@ -5367,11 +5356,10 @@ snapshots: idb@8.0.3: {} - idea-react@3.0.0-rc.4(mobx-react@10.0.4(mobx@7.1.7)(react@19.3.1))(mobx@7.1.7)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(typescript@6.0.3): + idea-react@3.0.0-rc.6(mobx-react@10.0.4(mobx@7.1.7)(react@19.3.1))(mobx@7.1.7)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(typescript@6.0.3): dependencies: '@shikijs/langs': 4.6.0 '@shikijs/themes': 4.6.0 - '@swc/helpers': 0.5.24 bootstrap: 6.0.0-alpha.1(vanilla-calendar-pro@3.4.0) classnames: 2.5.1 html2canvas: 1.4.1 @@ -5386,7 +5374,7 @@ snapshots: react-live: 5.0.1(react-dom@19.3.1(react@19.3.1))(react@19.3.1) shiki: 4.6.0 vanilla-calendar-pro: 3.4.0 - web-utility: 4.8.2(typescript@6.0.3) + web-utility: 4.8.3(typescript@6.0.3) transitivePeerDependencies: - '@floating-ui/dom' - element-internals-polyfill @@ -6215,7 +6203,7 @@ snapshots: dependencies: '@swc/helpers': 0.5.24 classnames: 2.5.1 - idea-react: 3.0.0-rc.4(mobx-react@10.0.4(mobx@7.1.7)(react@19.3.1))(mobx@7.1.7)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(typescript@6.0.3) + idea-react: 3.0.0-rc.6(mobx-react@10.0.4(mobx@7.1.7)(react@19.3.1))(mobx@7.1.7)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(typescript@6.0.3) lodash: 4.18.1 mobx: 7.1.7 mobx-i18n: 0.7.9(mobx@7.1.7)(typescript@6.0.3) @@ -7262,6 +7250,13 @@ snapshots: regenerator-runtime: 0.14.1 typescript: 6.0.3 + web-utility@4.8.3(typescript@6.0.3): + dependencies: + '@swc/helpers': 0.5.24 + mime: 4.1.2 + regenerator-runtime: 0.14.1 + typescript: 6.0.3 + which-boxed-primitive@1.1.1: dependencies: is-bigint: 1.1.0 From d1289959a74ceb4c1e0954308db0cb94f3409788 Mon Sep 17 00:00:00 2001 From: TechQuery Date: Mon, 23 Nov 2026 21:44:41 +0800 Subject: [PATCH 4/4] fix(navbar): allow submenu expansion within the drawer and adjust menu item styles --- components/Navigator/MainNavigator.module.css | 7 +------ components/Navigator/MainNavigator.tsx | 2 +- components/Navigator/MainNavigatorMenu.tsx | 4 +++- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/components/Navigator/MainNavigator.module.css b/components/Navigator/MainNavigator.module.css index e9cf352..efc1749 100644 --- a/components/Navigator/MainNavigator.module.css +++ b/components/Navigator/MainNavigator.module.css @@ -47,18 +47,13 @@ bottom: -5px; } -/* Keep submenus inside the scrollable drawer instead of positioning them in the viewport. */ +/* Allow the submenu to expand within the drawer. */ .inlineMenu { - position: static !important; - min-width: 0; - max-width: 100% !important; max-height: none !important; } .menuItem { color: var(--bs-menu-item-color); - white-space: normal; - overflow-wrap: anywhere; } .menuItem:hover, diff --git a/components/Navigator/MainNavigator.tsx b/components/Navigator/MainNavigator.tsx index c9d18ba..7d60010 100644 --- a/components/Navigator/MainNavigator.tsx +++ b/components/Navigator/MainNavigator.tsx @@ -164,9 +164,9 @@ export class MainNavigator extends Component { href && ( {title} diff --git a/components/Navigator/MainNavigatorMenu.tsx b/components/Navigator/MainNavigatorMenu.tsx index f5015ec..4dd2ee6 100644 --- a/components/Navigator/MainNavigatorMenu.tsx +++ b/components/Navigator/MainNavigatorMenu.tsx @@ -82,7 +82,9 @@ export class MainNavigatorMenu extends Component { theme="dark" className={desktop ? undefined : 'w-100'} offset={desktop ? [this.horizontalOffset, 4] : undefined} - menuClassName={desktop ? styles.menu : styles.inlineMenu} + menuClassName={ + desktop ? styles.menu : `${styles.inlineMenu} position-static min-w-0 max-w-100` + } toggleProps={{ className: styles.link, 'aria-current': active ? 'true' : undefined,