Fix action menu dropdown (#8368)

Fix action menu dropdown not closing when clicking outside the table or
board and introduce helper functions to get the action menu component
ids.
This commit is contained in:
Raphaël Bosi
2024-11-06 16:11:31 +01:00
committed by GitHub
parent 278ab4c513
commit a6007d4376
21 changed files with 166 additions and 78 deletions

View File

@ -0,0 +1,9 @@
import { getActionBarIdFromActionMenuId } from '@/action-menu/utils/getActionBarIdFromActionMenuId';
describe('getActionBarIdFromActionMenuId', () => {
it('should return the correct action bar id', () => {
expect(getActionBarIdFromActionMenuId('action-menu-id')).toBe(
'action-bar-action-menu-id',
);
});
});

View File

@ -0,0 +1,9 @@
import { getActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getActionMenuDropdownIdFromActionMenuId';
describe('getActionMenuDropdownIdFromActionMenuId', () => {
it('should return the correct action menu dropdown id', () => {
expect(getActionMenuDropdownIdFromActionMenuId('action-menu-id')).toBe(
'action-menu-dropdown-action-menu-id',
);
});
});

View File

@ -0,0 +1,9 @@
import { getActionMenuIdFromRecordIndexId } from '@/action-menu/utils/getActionMenuIdFromRecordIndexId';
describe('getActionMenuIdFromRecordIndexId', () => {
it('should return the correct action menu id', () => {
expect(getActionMenuIdFromRecordIndexId('record-index-id')).toBe(
'action-menu-record-index-record-index-id',
);
});
});

View File

@ -0,0 +1,3 @@
export const getActionBarIdFromActionMenuId = (actionMenuId: string) => {
return `action-bar-${actionMenuId}`;
};

View File

@ -0,0 +1,5 @@
export const getActionMenuDropdownIdFromActionMenuId = (
actionMenuId: string,
) => {
return `action-menu-dropdown-${actionMenuId}`;
};

View File

@ -0,0 +1,3 @@
export const getActionMenuIdFromRecordIndexId = (recordIndexId: string) => {
return `action-menu-record-index-${recordIndexId}`;
};