diff --git a/CHANGELOG.md b/CHANGELOG.md index abfc28b4..460ec960 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,8 @@ This changelog follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) - Searchable pickers keep the search field fixed and scroll only the option list within the available popover height, without nested scrollbars or native scroll arrows. - DNS cache and resolution-log rows open the rule dialog for their own domain, with labelled icon actions instead of selection-dependent toolbar buttons. Cache labels use concise stale deadlines and an unambiguous memory-only notice; Chinese selection prompts use formal wording. +- Group editor region checkboxes scroll with the dialog body instead of adding nested scrollbars. +- Searchable menus and the group editor's Groups and Nodes pickers keep their search field fixed and scroll only the option list when space is limited. - Import and restore retain an accepted operation whose outcome is unknown after closing the dialog or leaving Configuration. Reopening offers recovery without sending another write; failures retain their backend details in Copy error and Settings' recent errors. (#337) - Release notices credit Adobe for the bundled Noto fonts and name the locale runtime helper; RPMs include all staged licence files, and installer metadata includes Twemoji's CC-BY-4.0. - Release notices credit Adobe for the bundled Noto fonts and name the locale runtime helper; RPMs include all staged licence files, and installer metadata includes Twemoji's CC-BY-4.0. (#359) diff --git a/e2e/mobile-layout.spec.ts b/e2e/mobile-layout.spec.ts index 42656e89..698c9f1d 100644 --- a/e2e/mobile-layout.spec.ts +++ b/e2e/mobile-layout.spec.ts @@ -1,4 +1,4 @@ -import {expect, routes, test} from './fixtures'; +import {expect, routes, settleFrames, test} from './fixtures'; for (const width of [1280, 1024, 390, 320]) { test.describe(`${width}px layout`, () => { @@ -105,3 +105,66 @@ test.describe('390x844 portrait', () => { await expect(page.locator('.rp-top')).toHaveCSS('position', 'sticky'); }); }); + +test('group forms and searchable menus avoid nested scrolling', async ({page}) => { + const findings: Array<{state: string; axis: string; inner: string; outer: string}> = []; + const inspect = async (state: string) => { + await settleFrames(page); + const pairs = await page.locator('.rp-modal, .rp-popover').evaluateAll(roots => { + const pairs: Array<{axis: string; inner: string; outer: string}> = []; + for (const root of roots) { + for (const inner of root.querySelectorAll('*')) { + if (!inner.getClientRects().length) continue; + for (const axis of ['x', 'y']) { + const scrolls = (el: Element) => { + const style = getComputedStyle(el); + return ( + /^(auto|scroll)$/.test(axis === 'y' ? style.overflowY : style.overflowX) && + (axis === 'y' ? el.scrollHeight > el.clientHeight + 1 : el.scrollWidth > el.clientWidth + 1) + ); + }; + if (!scrolls(inner)) continue; + const page = document.scrollingElement!; + if ( + axis === 'y' && + root.matches('.rp-modal') && + page.scrollHeight > page.clientHeight + 1 && + !/^(hidden|clip)$/.test(getComputedStyle(page).overflowY) + ) + pairs.push({axis, inner: inner.className, outer: 'page'}); + for (let outer = inner.parentElement; outer; outer = outer.parentElement) { + if (scrolls(outer)) pairs.push({axis, inner: inner.className, outer: outer.className}); + if (outer === root) break; + } + } + } + } + return pairs; + }); + findings.push(...pairs.map(pair => ({state, ...pair}))); + }; + await page.setViewportSize({width: 1024, height: 700}); + await page.goto('/#/policies'); + await page.getByRole('button', {name: 'New group', exact: true}).click(); + const dialog = page.getByRole('dialog', {name: 'New group', exact: true}); + await inspect('group regions'); + await dialog.getByRole('button', {name: 'Advanced', exact: true}).click(); + for (const name of ['Groups', 'Nodes']) { + await dialog.getByRole('button', {name, exact: true}).click(); + await expect(page.getByRole('listbox', {name, exact: true})).toBeVisible(); + await inspect(name); + await page.keyboard.press('Escape'); + await expect(page.locator('.rp-popover')).toHaveCount(0); + } + await dialog.getByRole('button', {name: 'Cancel', exact: true}).click(); + await page.getByRole('button', {name: 'Edit group', exact: true}).first().click(); + await inspect('edit group regions'); + await page.getByRole('dialog').getByRole('button', {name: 'Cancel', exact: true}).click(); + await page.goto('/#/connections?tab=list'); + await page.getByRole('button', {name: 'Select', exact: true}).click(); + await expect(page.getByRole('menu', {name: 'Select', exact: true})).toBeVisible(); + await inspect('connection filters'); + await page.keyboard.press('Escape'); + await page.setViewportSize({width: 390, height: 844}); + expect(findings).toEqual([]); +}); diff --git a/src/ui/Menu.tsx b/src/ui/Menu.tsx index abd2ae4c..1ce0ceed 100644 --- a/src/ui/Menu.tsx +++ b/src/ui/Menu.tsx @@ -103,7 +103,7 @@ export function MenuButton({ {label} )} - + {content} @@ -255,7 +255,7 @@ function SubmenuMenu({label, submenus: source, actions = []}: {label: string; su 'sections' in submenu ? ( - + 1} /> diff --git a/src/ui/SearchMultiSelect.tsx b/src/ui/SearchMultiSelect.tsx index 7571c378..6adb7982 100644 --- a/src/ui/SearchMultiSelect.tsx +++ b/src/ui/SearchMultiSelect.tsx @@ -46,7 +46,7 @@ export function SearchMultiSelect({ {summary} - + ( diff --git a/src/ui/styles/buttons-menus.css b/src/ui/styles/buttons-menus.css index c1fdad2d..88f9c836 100644 --- a/src/ui/styles/buttons-menus.css +++ b/src/ui/styles/buttons-menus.css @@ -166,6 +166,20 @@ section:not(:first-child) > .rp-sec-h { width: max-content; max-width: calc(100vw - 24px); } +/* Search stays above a long list; only the list consumes the available popover height. */ +.rp-list-popover:has(.rp-menu-scroll), +.rp-list-popover:has(.rp-menu-scroll) :is(.rp-drill, section[role='dialog']) { + display: flex; + flex-direction: column; + min-height: 0; + overflow: hidden; +} +.rp-list-popover .rp-menu-scroll { + min-height: 0; +} +.rp-list-popover :is(.rp-menu-search, .rp-drill-back) { + flex: none; +} /* A dialog in a popover, after S2's: a title over its content, with a dialog's inset rather than a menu's. */ .rp-popover-dialog { inline-size: min(300px, calc(100vw - 24px)); diff --git a/src/ui/styles/fields.css b/src/ui/styles/fields.css index 4f00161f..ac1abc4e 100644 --- a/src/ui/styles/fields.css +++ b/src/ui/styles/fields.css @@ -269,8 +269,6 @@ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--rp-space-2) var(--rp-space-4); - max-height: 160px; - overflow: auto; padding: var(--rp-space-1); } .rp-checkbox-options .rp-radio-text {