Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v17] Web: fix pointer events disabling hover badges on integration tiles #48685

Merged
merged 4 commits into from
Nov 8, 2024
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
1 change: 1 addition & 0 deletions web/packages/shared/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ const StyledSelect = styled.div<{
}
}
.react-select__menu {
z-index: 10;
margin-top: 0px;
// If the component is on an elevated platform (such as a dialog), use a lighter background.
background-color: ${props =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import React from 'react';
import { MemoryRouter } from 'react-router';
import { render, screen } from 'design/utils/testing';
import { render, screen, userEvent } from 'design/utils/testing';

import cfg from 'teleport/config';

Expand Down Expand Up @@ -51,8 +51,10 @@ test('render disabled', async () => {
</MemoryRouter>
);

expect(screen.getByText(/lacking permission/i)).toBeInTheDocument();
expect(screen.queryByRole('link')).not.toBeInTheDocument();
expect(
screen.queryByText(/request additional permissions/i)
).not.toBeInTheDocument();

const tile = screen.getByTestId('tile-aws-oidc');
expect(tile).not.toHaveAttribute('href');
Expand All @@ -61,6 +63,13 @@ test('render disabled', async () => {
// so "toBeDisabled" interprets it as false.
// eslint-disable-next-line jest-dom/prefer-enabled-disabled
expect(tile).toHaveAttribute('disabled');

// Disabled states have badges on them. Test it renders on hover.
const badge = screen.getByText(/lacking permission/i);
await userEvent.hover(badge);
expect(
screen.getByText(/request additional permissions/i)
).toBeInTheDocument();
});

test('dont render External Audit Storage for enterprise unless it is cloud', async () => {
Expand Down
10 changes: 4 additions & 6 deletions web/packages/teleport/src/Integrations/Enroll/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,20 @@ export const IntegrationTile = styled(Flex)<{
width: 170px;
background-color: ${({ theme }) => theme.colors.buttons.secondary.default};
text-align: center;
cursor: pointer;

cursor: ${({ disabled, $exists }) =>
disabled || $exists ? 'default' : 'pointer'};
${props => {
const pointerEvents = props.disabled || props.$exists ? 'none' : 'auto';
if (props.$exists) {
return { pointerEvents };
return;
}

return `
opacity: ${props.disabled ? '0.45' : '1'};
&:hover {
background-color: ${props.theme.colors.buttons.secondary.hover};
}
pointer-events: ${pointerEvents};
`;
}}
}};
`;

export const NoCodeIntegrationDescription = () => (
Expand Down
Loading