mirror of
https://github.com/Zakkaus/doona.git
synced 2026-12-06 08:02:04 +00:00
fix(ui): keep one scroll container per overlay region
This commit is contained in:
1 parent
aafdd56d8e
commit
ca2eccf0bb
6 files changed
+83
-6
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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([]);
|
||||
});
|
||||
+2
-2
@@ -103,7 +103,7 @@ export function MenuButton({
|
||||
<Tip triggerRef={triggerRef}>{label}</Tip>
|
||||
</TooltipTrigger>
|
||||
)}
|
||||
<Popover className="rp-popover" placement={placement}>
|
||||
<Popover className="rp-popover rp-list-popover" placement={placement}>
|
||||
{content}
|
||||
</Popover>
|
||||
</MenuTrigger>
|
||||
@@ -255,7 +255,7 @@ function SubmenuMenu({label, submenus: source, actions = []}: {label: string; su
|
||||
'sections' in submenu ? (
|
||||
<SubmenuTrigger key={submenu.label}>
|
||||
<SubmenuItem {...submenu} />
|
||||
<Popover className="rp-popover" offset={-4} crossOffset={-9}>
|
||||
<Popover className="rp-popover rp-list-popover" offset={-4} crossOffset={-9}>
|
||||
<SectionMenu {...submenu} headers={submenu.sections.length > 1} />
|
||||
</Popover>
|
||||
</SubmenuTrigger>
|
||||
|
||||
@@ -46,7 +46,7 @@ export function SearchMultiSelect({
|
||||
<span id={summaryId}>{summary}</span>
|
||||
<ChevronDown />
|
||||
</Button>
|
||||
<Popover className="rp-popover rp-search-popover" placement="bottom start">
|
||||
<Popover className="rp-popover rp-search-popover rp-list-popover" placement="bottom start">
|
||||
<Dialog
|
||||
aria-label={label}
|
||||
render={props => (
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user