mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-05 00:14:18 +00:00
fix: keep Tab and the / shortcut out of a message list hidden by the open message
This commit is contained in:
@@ -273,6 +273,24 @@ describe.each([
|
||||
});
|
||||
});
|
||||
|
||||
describe('A list collapsed under an open message (focused layout)', () => {
|
||||
const list = () => screen.getByText('message list').closest('section')!;
|
||||
|
||||
it('is out of the Tab order while the message is open', async () => {
|
||||
render(<MailApp />);
|
||||
await screen.findByText('stub archive', {}, { timeout: 5000 });
|
||||
expect(list()).toHaveAttribute('inert');
|
||||
});
|
||||
|
||||
it('comes back for the / shortcut, whose search field lives in it', async () => {
|
||||
render(<MailApp />);
|
||||
await screen.findByText('stub archive', {}, { timeout: 5000 });
|
||||
act(() => { fireEvent.keyDown(window, { key: '/' }); });
|
||||
await waitFor(() => expect(selectedId()).toBeNull());
|
||||
await waitFor(() => expect(list()).not.toHaveAttribute('inert'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('The e shortcut in Mountain View', () => {
|
||||
beforeEach(() => {
|
||||
useSettingsStore.setState({ interfaceLayout: 'mountain-view' } as never);
|
||||
|
||||
@@ -1109,10 +1109,19 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
|
||||
},
|
||||
onFocusSearch: () => {
|
||||
if (isScheduledView) return;
|
||||
const searchInput = document.querySelector('[data-search-input]') as HTMLInputElement;
|
||||
if (searchInput) {
|
||||
searchInput.focus();
|
||||
searchInput.select();
|
||||
const focusSearch = () => {
|
||||
const searchInput = document.querySelector('[data-search-input]') as HTMLInputElement;
|
||||
if (searchInput) {
|
||||
searchInput.focus();
|
||||
searchInput.select();
|
||||
}
|
||||
};
|
||||
// The field is in the list, which an open message can have collapsed.
|
||||
if (shouldCollapseListPane) {
|
||||
handleMobileBack();
|
||||
requestAnimationFrame(() => requestAnimationFrame(focusSearch));
|
||||
} else {
|
||||
focusSearch();
|
||||
}
|
||||
},
|
||||
onShowHelp: () => {
|
||||
@@ -5089,6 +5098,9 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
|
||||
<section
|
||||
ref={listPaneRef}
|
||||
aria-labelledby={listHeadingId}
|
||||
// Collapsed to no width under the reading pane: Tab must not walk
|
||||
// through its toolbar and rows, which nobody can see.
|
||||
inert={shouldCollapseListPane}
|
||||
className={cn(
|
||||
"relative flex flex-col bg-background min-w-0",
|
||||
isHorizontalMailLayout
|
||||
|
||||
Reference in New Issue
Block a user