Fix Windows secondary hover titlebar blocking

This commit is contained in:
2026-04-10 01:54:12 -07:00
parent 7698258f61
commit 20a0efe572
6 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
type: fixed
area: overlay
- Fixed Windows secondary subtitle hover mode so the expanded hover hit area no longer blocks the native minimize, maximize, and close buttons.

View File

@@ -230,6 +230,42 @@ test('resolvePlatformInfo supports modal layer and disables mouse-ignore toggles
}
});
test('resolvePlatformInfo flags Windows platforms', () => {
const previousWindow = (globalThis as { window?: unknown }).window;
const previousNavigator = (globalThis as { navigator?: unknown }).navigator;
Object.defineProperty(globalThis, 'window', {
configurable: true,
value: {
electronAPI: {
getOverlayLayer: () => 'visible',
},
location: { search: '' },
},
});
Object.defineProperty(globalThis, 'navigator', {
configurable: true,
value: {
platform: 'Win32',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)',
},
});
try {
const info = resolvePlatformInfo();
assert.equal(info.isWindowsPlatform, true);
assert.equal(info.isMacOSPlatform, false);
assert.equal(info.isLinuxPlatform, false);
assert.equal(info.shouldToggleMouseIgnore, true);
} finally {
Object.defineProperty(globalThis, 'window', { configurable: true, value: previousWindow });
Object.defineProperty(globalThis, 'navigator', {
configurable: true,
value: previousNavigator,
});
}
});
test('isYomitanPopupIframe matches modern popup class and legacy id prefix', () => {
const createElement = (options: {
tagName: string;

View File

@@ -529,6 +529,9 @@ async function init(): Promise<void> {
if (ctx.platform.isMacOSPlatform) {
document.body.classList.add('platform-macos');
}
if (ctx.platform.isWindowsPlatform) {
document.body.classList.add('platform-windows');
}
if (ctx.platform.shouldToggleMouseIgnore) {
syncOverlayMouseIgnoreState(ctx);
}

View File

@@ -1131,6 +1131,11 @@ body.subtitle-sidebar-embedded-open #secondarySubContainer.secondary-sub-hover {
justify-content: center;
}
body.platform-windows #secondarySubContainer.secondary-sub-hover {
top: 40px;
padding-top: 0;
}
#secondarySubContainer.secondary-sub-hover #secondarySubRoot {
background: transparent;
backdrop-filter: none;

View File

@@ -989,6 +989,13 @@ test('JLPT CSS rules use underline-only styling in renderer stylesheet', () => {
/transform:\s*translateX\(calc\(var\(--subtitle-sidebar-reserved-width\)\s*\*\s*-0\.5\)\);/,
);
const secondaryHoverWindowsBlock = extractClassBlock(
cssText,
'body.platform-windows #secondarySubContainer.secondary-sub-hover',
);
assert.match(secondaryHoverWindowsBlock, /top:\s*40px;/);
assert.match(secondaryHoverWindowsBlock, /padding-top:\s*0;/);
const subtitleSidebarListBlock = extractClassBlock(cssText, '.subtitle-sidebar-list');
assert.doesNotMatch(subtitleSidebarListBlock, /scroll-behavior:\s*smooth;/);

View File

@@ -5,6 +5,7 @@ export type PlatformInfo = {
isModalLayer: boolean;
isLinuxPlatform: boolean;
isMacOSPlatform: boolean;
isWindowsPlatform: boolean;
shouldToggleMouseIgnore: boolean;
};
@@ -24,12 +25,15 @@ export function resolvePlatformInfo(): PlatformInfo {
const isLinuxPlatform = navigator.platform.toLowerCase().includes('linux');
const isMacOSPlatform =
navigator.platform.toLowerCase().includes('mac') || /mac/i.test(navigator.userAgent);
const isWindowsPlatform =
navigator.platform.toLowerCase().includes('win') || /windows/i.test(navigator.userAgent);
return {
overlayLayer,
isModalLayer,
isLinuxPlatform,
isMacOSPlatform,
isWindowsPlatform,
shouldToggleMouseIgnore: !isLinuxPlatform && !isModalLayer,
};
}