Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ const ExportDiagramModal = ({
<Radio
checked={exportFormat === 'diagram'}
value="diagram"
aria-label="Diagram File"
aria-label="MDM File"
onClick={() => onSelectFormat('diagram')}
size="small"
description="Importable into Compass and Data Explorer so teammates can collaborate."
>
Diagram File
MDM File
</Radio>
</div>
<div className={radioItemStyles}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Button,
type ButtonProps,
FileSelector,
Tooltip,
} from '@mongodb-js/compass-components';

type ImportDiagramButtonProps = Omit<ButtonProps, 'onClick'> & {
Expand All @@ -14,22 +15,31 @@ export const ImportDiagramButton = ({
...buttonProps
}: ImportDiagramButtonProps) => {
return (
<FileSelector
id="import-diagram-file-input"
data-testid="import-diagram-file-input"
multiple={false}
accept=".mdm"
onSelect={(files) => {
if (files.length === 0) {
return;
}
onImportDiagram(files[0]);
}}
trigger={({ onClick }) => (
<Button {...buttonProps} onClick={onClick}>
Import diagram
</Button>
)}
/>
<Tooltip
trigger={
<span>
Comment on lines +18 to +20
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wrapping <span> prevents proper keyboard navigation and focus management for the button inside. Consider using the disabled prop pattern or removing the span wrapper to maintain accessibility.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

@paula-stacho paula-stacho Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The span is important, we have two triggers on that btn and it gets messed up otherwise. I checked the keyboard navigation and it works fine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a div element with inline styles work? span is usually for text content.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would work the same, sure, but is it for text content? According to mdn,

<span> is very much like a <div> element, but <div> is a block-level element whereas a <span> is an inline-level element.

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/span

<FileSelector
id="import-diagram-file-input"
data-testid="import-diagram-file-input"
multiple={false}
accept=".mdm"
onSelect={(files) => {
if (files.length === 0) {
return;
}
onImportDiagram(files[0]);
}}
trigger={({ onClick }) => (
<Button {...buttonProps} onClick={onClick}>
Import diagram
</Button>
)}
/>
</span>
}
>
Only MDM files exported from Compass or Atlas Data Explorer can be
imported.
</Tooltip>
);
};
2 changes: 1 addition & 1 deletion packages/compass-e2e-tests/helpers/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ export const DataModelExportButton = 'button[aria-label="Export"]';
export const DataModelExportModal = '[data-testid="export-diagram-modal"]';
export const DataModelExportPngOption = `${DataModelExportModal} input[aria-label="PNG"]`;
export const DataModelExportJsonOption = `${DataModelExportModal} input[aria-label="JSON"]`;
export const DataModelExportDiagramOption = `${DataModelExportModal} input[aria-label="Diagram File"]`;
export const DataModelExportDiagramOption = `${DataModelExportModal} input[aria-label="MDM File"]`;
export const DataModelExportModalConfirmButton =
'[data-testid="export-button"]';
export const DataModelsListItem = (diagramName?: string) => {
Expand Down
Loading