Skip to content

Commit

Permalink
refactor: [M3-8125] Remove and Prevent tooltip disableInteractive (li…
Browse files Browse the repository at this point in the history
…node#10501)

* remove and prevent tooltip disableInteractive

* Added changeset: Remove and Prevent tooltip disableInteractive

* feedback @mjac0bs
  • Loading branch information
abailly-akamai committed May 22, 2024
1 parent b774f62 commit 0d03587
Show file tree
Hide file tree
Showing 25 changed files with 16 additions and 76 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
---

Make all tooltips Interactive and prevent `disableInteractive` for future usage ([#10501](https://github.com/linode/manager/pull/10501))
3 changes: 0 additions & 3 deletions packages/manager/src/components/AccessPanel/AccessPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ interface Props {
setAuthorizedUsers?: (usernames: string[]) => void;
small?: boolean;
toggleDiskEncryptionEnabled?: () => void;
tooltipInteractive?: boolean;
}

export const AccessPanel = (props: Props) => {
Expand All @@ -79,7 +78,6 @@ export const AccessPanel = (props: Props) => {
selectedRegion,
setAuthorizedUsers,
toggleDiskEncryptionEnabled,
tooltipInteractive,
} = props;

const { classes, cx } = useStyles();
Expand Down Expand Up @@ -156,7 +154,6 @@ export const AccessPanel = (props: Props) => {
onChange={handleChange}
placeholder={placeholder || 'Enter a password.'}
required={required}
tooltipInteractive={tooltipInteractive}
value={password || ''}
/>
</React.Suspense>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ const BackupStatus = (props: Props) => {
padding: 0,
}}
classes={{ tooltip: classes.tooltip }}
interactive
status="help"
text={backupsUnavailableMessage}
/>
Expand Down
17 changes: 3 additions & 14 deletions packages/manager/src/components/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as React from 'react';

import CheckboxIcon from 'src/assets/icons/checkbox.svg';
import CheckboxCheckedIcon from 'src/assets/icons/checkboxChecked.svg';
import { TooltipIcon } from 'src/components/TooltipIcon';
import { FormControlLabel } from 'src/components/FormControlLabel';
import { TooltipIcon } from 'src/components/TooltipIcon';

interface Props extends CheckboxProps {
/**
Expand All @@ -17,11 +17,6 @@ interface Props extends CheckboxProps {
* Renders a `FormControlLabel` that controls the underlying Checkbox with a label of `text`
*/
text?: JSX.Element | string;
/**
* Whether or not the tooltip is interactive
* @default false
*/
toolTipInteractive?: boolean;
/**
* Renders a tooltip to the right of the Checkbox
*/
Expand All @@ -44,7 +39,7 @@ interface Props extends CheckboxProps {
* - If the user clicks the Back button, any changes made to checkboxes should be discarded and the original settings reinstated.
*/
export const Checkbox = (props: Props) => {
const { sxFormLabel, text, toolTipInteractive, toolTipText, ...rest } = props;
const { sxFormLabel, text, toolTipText, ...rest } = props;

const BaseCheckbox = (
<StyledCheckbox
Expand All @@ -69,13 +64,7 @@ export const Checkbox = (props: Props) => {
return (
<>
{CheckboxComponent}
{toolTipText ? (
<TooltipIcon
interactive={toolTipInteractive}
status="help"
text={toolTipText}
/>
) : null}
{toolTipText ? <TooltipIcon status="help" text={toolTipText} /> : null}
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const PasswordInput = (props: Props) => {
hideStrengthLabel,
hideValidation,
required,
tooltipInteractive,
value,
...rest
} = props;
Expand All @@ -33,7 +32,6 @@ const PasswordInput = (props: Props) => {
{...rest}
fullWidth
required={required}
tooltipInteractive={tooltipInteractive}
tooltipText={disabledReason}
value={value}
/>
Expand Down
3 changes: 0 additions & 3 deletions packages/manager/src/components/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ interface LabelToolTipProps {

interface InputToolTipProps {
tooltipClasses?: string;
tooltipInteractive?: boolean;
tooltipOnMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
tooltipPosition?: TooltipProps['placement'];
tooltipText?: JSX.Element | string;
Expand Down Expand Up @@ -251,7 +250,6 @@ export const TextField = (props: TextFieldProps) => {
optional,
required,
tooltipClasses,
tooltipInteractive,
tooltipOnMouseEnter,
tooltipPosition,
tooltipText,
Expand Down Expand Up @@ -484,7 +482,6 @@ export const TextField = (props: TextFieldProps) => {
padding: '6px',
}}
classes={{ popper: tooltipClasses }}
interactive={tooltipInteractive}
onMouseEnter={tooltipOnMouseEnter}
status="help"
text={tooltipText}
Expand Down
6 changes: 0 additions & 6 deletions packages/manager/src/components/Toggle/Toggle.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ export const Default: StoryObj<ToggleProps> = {
render: (args) => <Toggle {...args} tooltipText={EXAMPLE_TEXT} />,
};

export const WithInteractiveTooltip: StoryObj<ToggleProps> = {
render: (args) => (
<Toggle {...args} interactive={true} tooltipText={EXAMPLE_TEXT} />
),
};

const meta: Meta<ToggleProps> = {
args: {
disabled: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/Toggle/Toggle.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Toggle component', () => {
});
it('should render a tooltip button', async () => {
const screen = renderWithTheme(
<Toggle interactive={true} tooltipText={'some tooltip text'} />
<Toggle tooltipText={'some tooltip text'} />
);
const tooltipButton = screen.getByRole('button');
expect(tooltipButton).toBeInTheDocument();
Expand Down
14 changes: 2 additions & 12 deletions packages/manager/src/components/Toggle/Toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import ToggleOn from 'src/assets/icons/toggleOn.svg';
import { TooltipIcon } from 'src/components/TooltipIcon';

export interface ToggleProps extends SwitchProps {
/**
* Makes a tooltip interactive (meaning the tooltip will not close when the user hovers over the tooltip). Note that in order for the tooltip to show up, tooltipText must be passed in as a prop.
*/
interactive?: boolean;
/**
* Content to display inside an optional tooltip.
*/
Expand All @@ -28,7 +24,7 @@ export interface ToggleProps extends SwitchProps {
* > **Note:** Do not use toggles in long forms where other types of form fields are present, and users will need to click a Submit button for other changes to take effect. This scenario confuses users because they can’t be sure whether their toggle choice will take immediate effect.
*/
export const Toggle = (props: ToggleProps) => {
const { interactive, tooltipText, ...rest } = props;
const { tooltipText, ...rest } = props;

return (
<React.Fragment>
Expand All @@ -39,13 +35,7 @@ export const Toggle = (props: ToggleProps) => {
icon={<ToggleOff />}
{...rest}
/>
{tooltipText && (
<TooltipIcon
interactive={interactive}
status="help"
text={tooltipText}
/>
)}
{tooltipText && <TooltipIcon status="help" text={tooltipText} />}
</React.Fragment>
);
};
12 changes: 4 additions & 8 deletions packages/manager/src/components/TooltipIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ interface EnhancedTooltipProps extends TooltipProps {
}

export interface TooltipIconProps
extends Omit<TooltipProps, 'children' | 'leaveDelay' | 'title'> {
extends Omit<
TooltipProps,
'children' | 'disableInteractive' | 'leaveDelay' | 'title'
> {
/**
* An optional className that does absolutely nothing
*/
Expand All @@ -35,11 +38,6 @@ export interface TooltipIconProps
* @todo this seems like a flaw... passing an icon should not require `status` to be `other`
*/
icon?: JSX.Element;
/**
* Makes the tooltip interactive (stays open when cursor is over tooltip)
* @default false
*/
interactive?: boolean;
/**
* Enables a leaveDelay of 3000ms
* @default false
Expand Down Expand Up @@ -92,7 +90,6 @@ export const TooltipIcon = (props: TooltipIconProps) => {
const {
classes,
icon,
interactive,
leaveDelay,
status,
sx,
Expand Down Expand Up @@ -155,7 +152,6 @@ export const TooltipIcon = (props: TooltipIconProps) => {
classes={classes}
componentsProps={props.componentsProps}
data-qa-help-tooltip
disableInteractive={!interactive}
enterTouchDelay={0}
leaveDelay={leaveDelay ? 3000 : undefined}
leaveTouchDelay={5000}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ export const MaintenanceWindow = (props: Props) => {
your timezone settings.
</Typography>
}
interactive
status="help"
/>
</div>
Expand Down
1 change: 0 additions & 1 deletion packages/manager/src/features/Images/ImageUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ export const ImageUpload: React.FC<Props> = (props) => {
checked={isCloudInit}
onChange={changeIsCloudInit}
text="This image is cloud-init compatible"
toolTipInteractive
toolTipText={cloudInitTooltipMessage}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ export const CreateImageTab = () => {
</Link>
</Typography>
}
interactive
status="help"
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export const UserDefinedFieldInput = ({ userDefinedField }: Props) => {
onChange={(e) => field.onChange(e.target.value)}
placeholder={isTokenPassword ? 'Enter your token' : 'Enter a password.'}
required={isRequired}
tooltipInteractive={isTokenPassword}
value={field.value ?? ''}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const UserDataHeading = () => {
.
</>
}
interactive
status="help"
sxTooltipIcon={{ p: 0 }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const UserDataAccordionHeading = (props: Props) => {
</Link>
</>
}
interactive
status="help"
sxTooltipIcon={{ alignItems: 'baseline', padding: '0 8px' }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,6 @@ export const LinodeConfigDialog = (props: Props) => {
paddingBottom: 0,
paddingTop: 0,
}}
interactive
status="help"
sx={{ tooltip: { maxWidth: 350 } }}
text={networkInterfacesHelperText}
Expand Down Expand Up @@ -1126,7 +1125,6 @@ export const LinodeConfigDialog = (props: Props) => {
}
checked={values.helpers.network}
disabled={isReadOnly}
interactive={true}
onChange={formik.handleChange}
/>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export const UnifiedMigrationPanel = (props: Props) => {
)}
</>
}
interactive
status="help"
tooltipPosition="right"
width={[theme.breakpoints.up('sm')] ? 375 : 300}
Expand Down Expand Up @@ -111,7 +110,6 @@ export const UnifiedMigrationPanel = (props: Props) => {
</Link>
</>
}
interactive
status="help"
tooltipPosition="right"
width={[theme.breakpoints.up('sm')] ? 450 : 300}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export const LinodeRow = (props: Props) => {
<div style={{ alignItems: 'center', display: 'flex' }}>
<strong>Maintenance Scheduled</strong>
<TooltipIcon
interactive
status="help"
sx={{ tooltip: { maxWidth: 300 } }}
text={<MaintenanceText />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const PublicIpsUnassignedTooltip = (
.
</Typography>
}
interactive
status="help"
sxTooltipIcon={sxTooltipIcon}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export const DisplaySettings = () => {
marginTop: '-2px',
padding: 0,
}}
interactive
status="help"
text={tooltipIconText}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ interface Props {
isPassword?: boolean;
placeholder?: string;
tooltip?: JSX.Element;
tooltipInteractive?: boolean;
updateFormState: (key: string, value: any) => void;
value: string;
}
Expand All @@ -41,14 +40,7 @@ class UserDefinedText extends React.Component<Props, {}> {
};

renderPasswordField = () => {
const {
error,
field,
isOptional,
placeholder,
tooltip,
tooltipInteractive,
} = this.props;
const { error, field, isOptional, placeholder, tooltip } = this.props;

return (
<StyledAccessPanel
Expand All @@ -61,7 +53,6 @@ class UserDefinedText extends React.Component<Props, {}> {
password={this.props.value}
placeholder={placeholder}
required={!isOptional}
tooltipInteractive={tooltipInteractive}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ const renderField = (
isOptional={isOptional}
isPassword={true}
placeholder={isTokenPassword ? 'Enter your token' : field.example}
tooltipInteractive={isTokenPassword}
updateFor={[field.label, udf_data[field.name], error]}
updateFormState={handleChange}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export const AssignIPRanges = (props: Props) => {
marginLeft: theme.spacing(0.5),
padding: theme.spacing(0.5),
}}
interactive
status="help"
text={IPv4RangesDescriptionJSX}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export const SubnetLinodeRow = (props: Props) => {
</Typography>
}
icon={<StyledWarningIcon />}
interactive
status="other"
sxTooltipIcon={{ paddingLeft: 0 }}
/>
Expand Down

0 comments on commit 0d03587

Please sign in to comment.