mirror of
https://github.com/readest/readest.git
synced 2026-12-01 13:36:39 +00:00
fix(reader): fill the 17px strip under the lifted desktop footer bar (#8026) (#8030)
Some checks are pending
CodeQL Advanced / CodeQL gate (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Blocked by required conditions
CodeQL Advanced / Analyze (javascript-typescript) (push) Blocked by required conditions
CodeQL Advanced / Analyze (python) (push) Blocked by required conditions
CodeQL Advanced / Analyze (rust) (push) Blocked by required conditions
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
Build with Nix / tests (push) Waiting to run
PR checks / CI gate (push) Waiting to run
PR checks / nix_flake_check (push) Blocked by required conditions
PR checks / rust_lint (push) Blocked by required conditions
PR checks / koplugin_rust_lint (push) Blocked by required conditions
PR checks / build_web_app (push) Blocked by required conditions
PR checks / test_web_app (1) (push) Blocked by required conditions
PR checks / test_web_app (2) (push) Blocked by required conditions
PR checks / test_web_browser (push) Blocked by required conditions
PR checks / test_extensions (push) Blocked by required conditions
PR checks / build_tauri_app (push) Blocked by required conditions
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
Some checks are pending
CodeQL Advanced / CodeQL gate (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Blocked by required conditions
CodeQL Advanced / Analyze (javascript-typescript) (push) Blocked by required conditions
CodeQL Advanced / Analyze (python) (push) Blocked by required conditions
CodeQL Advanced / Analyze (rust) (push) Blocked by required conditions
Publish Docker image / build (linux/amd64, ubuntu-latest) (push) Waiting to run
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Publish Docker image / merge (push) Blocked by required conditions
Build with Nix / tests (push) Waiting to run
PR checks / CI gate (push) Waiting to run
PR checks / nix_flake_check (push) Blocked by required conditions
PR checks / rust_lint (push) Blocked by required conditions
PR checks / koplugin_rust_lint (push) Blocked by required conditions
PR checks / build_web_app (push) Blocked by required conditions
PR checks / test_web_app (1) (push) Blocked by required conditions
PR checks / test_web_app (2) (push) Blocked by required conditions
PR checks / test_web_browser (push) Blocked by required conditions
PR checks / test_extensions (push) Blocked by required conditions
PR checks / build_tauri_app (push) Blocked by required conditions
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
#6786 raised the desktop footer's lift over a horizontal scrollbar (vertical text in Scrolled Mode, fixed-layout pages zoomed past 100%) from 12px to 17px, but the filler drawn under the shown bar stayed h-3. A 5px strip at the window's bottom edge showed the page through it: clipped text when the top and bottom margins are 0. The filler is now h-[17px]. Reported by doublex640 on GitHub. Verified: footer-bar-scrollbar-filler.browser fails with the filler back at h-3 (`expected 788 to be 783`, both cases) and passes with the change. On dev-web (Chromium, 1280x800) with a vertical-rl EPUB in Scrolled Mode and 0 margins, main's filler starts at y=788 under a bar ending at 783, with text showing between; the change covers 783-800 in light and dark mode. 7 footer unit suites (13 tests) and pnpm lint pass. Not run: Windows WebView2, macOS, a zoomed PDF in the app, e-ink. Co-authored-by: Antigravity (Gemini 4 Neon) <noreply@google.com> Co-authored-by: Antigravity (Gemini 4 Hydrogen) <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
62ed18f690
commit
59de975f6c
2 changed files with 115 additions and 1 deletions
|
|
@ -0,0 +1,114 @@
|
|||
import { bookDataStoreHooks } from '@/__tests__/helpers/book-data-store-mock';
|
||||
import { cleanup, render, screen } from '@testing-library/react';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { page } from 'vitest/browser';
|
||||
|
||||
import FooterBar from '@/app/reader/components/footerbar/FooterBar';
|
||||
import '@/styles/globals.css';
|
||||
|
||||
vi.mock('@/hooks/useTranslation', () => ({
|
||||
useTranslation: () => (key: string) => key,
|
||||
}));
|
||||
vi.mock('@/context/EnvContext', () => ({
|
||||
useEnv: () => ({ appService: { isMobile: false } }),
|
||||
}));
|
||||
const viewSettings = vi.hoisted(() => ({
|
||||
vertical: true,
|
||||
scrolled: true,
|
||||
zoomLevel: 100,
|
||||
}));
|
||||
const bookData = vi.hoisted(() => ({
|
||||
isFixedLayout: false,
|
||||
}));
|
||||
vi.mock('@/store/readerStore', () => ({
|
||||
useReaderStore: () => ({
|
||||
hoveredBookKey: 'book-1',
|
||||
setHoveredBookKey: vi.fn(),
|
||||
bottomBarTab: '',
|
||||
setBottomBarTab: vi.fn(),
|
||||
getView: () => null,
|
||||
getViewState: () => null,
|
||||
getProgress: () => null,
|
||||
getViewSettings: () => viewSettings,
|
||||
}),
|
||||
}));
|
||||
vi.mock('@/store/bookDataStore', () => ({
|
||||
...bookDataStoreHooks(() => ({
|
||||
getConfig: () => null,
|
||||
setConfig: vi.fn(),
|
||||
getBookData: () => bookData,
|
||||
})),
|
||||
}));
|
||||
vi.mock('@/store/sidebarStore', () => ({
|
||||
useSidebarStore: () => ({
|
||||
isSideBarVisible: false,
|
||||
isSideBarPinned: false,
|
||||
setSideBarVisible: vi.fn(),
|
||||
}),
|
||||
}));
|
||||
vi.mock('@/store/deviceStore', () => ({
|
||||
useDeviceControlStore: () => ({
|
||||
acquireBackKeyInterception: vi.fn(),
|
||||
releaseBackKeyInterception: vi.fn(),
|
||||
}),
|
||||
}));
|
||||
vi.mock('@/store/themeStore', () => ({
|
||||
useThemeStore: (select: (s: { isIPhoneDuo: boolean }) => unknown) =>
|
||||
select({ isIPhoneDuo: false }),
|
||||
}));
|
||||
vi.mock('@/app/reader/hooks/useSpatialNavigation', () => ({ useSpatialNavigation: () => {} }));
|
||||
vi.mock('@/app/reader/components/footerbar/MobileFooterBar', () => ({ default: () => null }));
|
||||
vi.mock('@/app/reader/components/footerbar/DesktopFooterBar', () => ({ default: () => null }));
|
||||
vi.mock('@/app/reader/components/tts/TTSControl', () => ({ default: () => null }));
|
||||
vi.mock('@/app/reader/components/rsvp', () => ({ RSVPControl: () => null }));
|
||||
|
||||
const insets = { top: 0, right: 0, bottom: 0, left: 0 };
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
viewSettings.vertical = true;
|
||||
viewSettings.scrolled = true;
|
||||
viewSettings.zoomLevel = 100;
|
||||
bookData.isFixedLayout = false;
|
||||
});
|
||||
|
||||
const renderAndAssertGapFilled = async (bookFormat: 'EPUB' | 'PDF') => {
|
||||
await page.viewport(1280, 800);
|
||||
render(
|
||||
<div className='relative h-[800px] w-[1280px]'>
|
||||
<FooterBar
|
||||
bookKey='book-1'
|
||||
bookFormat={bookFormat}
|
||||
isHoveredAnim={false}
|
||||
gridInsets={insets}
|
||||
/>
|
||||
</div>,
|
||||
);
|
||||
|
||||
const footer = screen.getByRole('contentinfo');
|
||||
const filler = footer.nextElementSibling as HTMLElement;
|
||||
expect(filler).not.toBeNull();
|
||||
expect(getComputedStyle(filler).pointerEvents).toBe('none');
|
||||
|
||||
const footerRect = footer.getBoundingClientRect();
|
||||
const fillerRect = filler.getBoundingClientRect();
|
||||
|
||||
expect(footerRect.bottom).toBe(800 - 17);
|
||||
expect(fillerRect.bottom).toBe(800);
|
||||
expect(fillerRect.top).toBe(footerRect.bottom);
|
||||
};
|
||||
|
||||
describe('FooterBar horizontal scrollbar filler (#8026)', () => {
|
||||
it('fills the entire 17px gap under the lifted desktop footer bar in scrolled vertical reading', async () => {
|
||||
await renderAndAssertGapFilled('EPUB');
|
||||
});
|
||||
|
||||
it('fills the entire 17px gap under the lifted desktop footer bar on a zoomed fixed-layout page', async () => {
|
||||
viewSettings.vertical = false;
|
||||
viewSettings.scrolled = false;
|
||||
viewSettings.zoomLevel = 150;
|
||||
bookData.isFixedLayout = true;
|
||||
|
||||
await renderAndAssertGapFilled('PDF');
|
||||
});
|
||||
});
|
||||
|
|
@ -337,7 +337,7 @@ const FooterBar: React.FC<FooterBarProps> = ({
|
|||
<DesktopFooterBar {...commonProps} />
|
||||
</div>
|
||||
{isVisible && needHorizontalScroll && (
|
||||
<div className='bg-base-100 pointer-events-none absolute bottom-0 left-0 hidden h-3 w-full sm:block' />
|
||||
<div className='bg-base-100 pointer-events-none absolute bottom-0 left-0 hidden h-[17px] w-full sm:block' />
|
||||
)}
|
||||
|
||||
<TTSControl bookKey={bookKey} gridInsets={gridInsets} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue