mirror of
https://github.com/immich-app/immich.git
synced 2024-09-21 10:37:20 +00:00
fix: scroll position when menu is initially opened
This commit is contained in:
parent
f4a776bb81
commit
5620a4abe9
@ -46,7 +46,11 @@ export const contextMenuNavigation: Action<HTMLElement, Options> = (node, option
|
|||||||
};
|
};
|
||||||
|
|
||||||
const moveSelection = async (direction: 'up' | 'down', event: KeyboardEvent) => {
|
const moveSelection = async (direction: 'up' | 'down', event: KeyboardEvent) => {
|
||||||
const { selectionChanged, container, openDropdown } = options;
|
const { selectionChanged, container, openDropdown, isOpen } = options;
|
||||||
|
if (!isOpen) {
|
||||||
|
// reset the scroll position before opening the menu
|
||||||
|
container?.scrollTo({ top: 0 });
|
||||||
|
}
|
||||||
if (openDropdown) {
|
if (openDropdown) {
|
||||||
openDropdown(event);
|
openDropdown(event);
|
||||||
await tick();
|
await tick();
|
||||||
|
Loading…
Reference in New Issue
Block a user