Skip to content

Commit

Permalink
Change default behaviour of Tooltip trigger to 'click'
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Feb 6, 2023
1 parent e5668ff commit e6b9c0f
Show file tree
Hide file tree
Showing 16 changed files with 6 additions and 27 deletions.
1 change: 0 additions & 1 deletion code/addons/a11y/src/components/VisionSimulator.tsx
Expand Up @@ -133,7 +133,6 @@ export const VisionSimulator = () => {
)}
<WithTooltip
placement="top"
trigger="click"
tooltip={({ onHide }) => {
const colorList = getColorList(filter, (i) => {
setFilter(i);
Expand Down
Expand Up @@ -116,7 +116,6 @@ export const BackgroundSelector: FC = memo(function BackgroundSelector() {
<Fragment>
<WithTooltip
placement="top"
trigger="click"
closeOnOutsideClick
tooltip={({ onHide }) => {
return (
Expand Down
1 change: 0 additions & 1 deletion code/addons/toolbars/src/components/ToolbarMenuList.tsx
Expand Up @@ -57,7 +57,6 @@ export const ToolbarMenuList: FC<ToolbarMenuListProps> = withKeyboardCycle(
return (
<WithTooltip
placement="top"
trigger="click"
tooltip={({ onHide }) => {
const links = items
// Special case handling for various "type" variants
Expand Down
1 change: 0 additions & 1 deletion code/addons/viewport/src/Tool.tsx
Expand Up @@ -180,7 +180,6 @@ export const ViewportTool: FC = memo(
<Fragment>
<WithTooltip
placement="top"
trigger="click"
tooltip={({ onHide }) => (
<TooltipLinkList links={toLinks(list, item, setState, state, onHide)} />
)}
Expand Down
1 change: 0 additions & 1 deletion code/ui/blocks/src/components/ArgsTable/ArgValue.tsx
Expand Up @@ -161,7 +161,6 @@ const ArgSummary: FC<ArgSummaryProps> = ({ value, initialExpandedArgs }) => {
return (
<WithTooltipPure
closeOnOutsideClick
trigger="click"
placement="bottom"
visible={isOpen}
onVisibleChange={(isVisible) => {
Expand Down
1 change: 0 additions & 1 deletion code/ui/blocks/src/controls/Color.tsx
Expand Up @@ -320,7 +320,6 @@ export const ColorControl: FC<ColorControlProps> = ({
return (
<Wrapper>
<PickerTooltip
trigger="click"
startOpen={startOpen}
closeOnOutsideClick
onVisibleChange={() => addPreset(color)}
Expand Down
2 changes: 1 addition & 1 deletion code/ui/components/src/tabs/tabs.stories.tsx
Expand Up @@ -220,7 +220,7 @@ export const StatefulDynamicWithOpenTooltip = {
const addonsTab = await canvas.findByRole('tab', { name: /Addons/ });

await waitFor(async () => {
await fireEvent(addonsTab, new MouseEvent('mouseenter', { bubbles: true }));
await fireEvent(addonsTab, new MouseEvent('click', { bubbles: true }));
const tooltip = await screen.getByTestId('tooltip');
await expect(tooltip).toBeInTheDocument();
});
Expand Down
2 changes: 1 addition & 1 deletion code/ui/components/src/tooltip/TooltipLinkList.stories.tsx
Expand Up @@ -38,7 +38,7 @@ export default {
height: '300px',
}}
>
<WithTooltip placement="top" trigger="click" startOpen tooltip={storyFn()}>
<WithTooltip placement="top" startOpen tooltip={storyFn()}>
<div>Tooltip</div>
</WithTooltip>
</div>
Expand Down
2 changes: 1 addition & 1 deletion code/ui/components/src/tooltip/TooltipMessage.stories.tsx
Expand Up @@ -12,7 +12,7 @@ export default {
height: '300px',
}}
>
<WithTooltip placement="top" trigger="click" startOpen tooltip={storyFn()}>
<WithTooltip placement="top" startOpen tooltip={storyFn()}>
<div>Tooltip</div>
</WithTooltip>
</div>
Expand Down
8 changes: 1 addition & 7 deletions code/ui/components/src/tooltip/TooltipNote.stories.tsx
Expand Up @@ -11,13 +11,7 @@ export default {
height: '300px',
}}
>
<WithTooltip
hasChrome={false}
placement="top"
trigger="click"
startOpen
tooltip={storyFn()}
>
<WithTooltip hasChrome={false} placement="top" startOpen tooltip={storyFn()}>
<div>Tooltip</div>
</WithTooltip>
</div>
Expand Down
4 changes: 0 additions & 4 deletions code/ui/components/src/tooltip/WithTooltip.stories.tsx
Expand Up @@ -86,7 +86,6 @@ export const SimpleHoverFunctional: StoryObj<ComponentProps<typeof WithTooltip>>
export const SimpleClick: StoryObj<ComponentProps<typeof WithTooltip>> = {
args: {
placement: 'top',
trigger: 'click',
},
render: (args) => (
<WithTooltip tooltip={<Tooltip />} {...args}>
Expand All @@ -98,7 +97,6 @@ export const SimpleClick: StoryObj<ComponentProps<typeof WithTooltip>> = {
export const SimpleClickStartOpen: StoryObj<ComponentProps<typeof WithTooltip>> = {
args: {
placement: 'top',
trigger: 'click',
startOpen: true,
},
render: (args) => (
Expand All @@ -111,7 +109,6 @@ export const SimpleClickStartOpen: StoryObj<ComponentProps<typeof WithTooltip>>
export const SimpleClickCloseOnClick: StoryObj<ComponentProps<typeof WithTooltip>> = {
args: {
placement: 'top',
trigger: 'click',
closeOnOutsideClick: true,
},
render: (args) => (
Expand All @@ -124,7 +121,6 @@ export const SimpleClickCloseOnClick: StoryObj<ComponentProps<typeof WithTooltip
export const WithoutChrome: StoryObj<ComponentProps<typeof WithTooltip>> = {
args: {
placement: 'top',
trigger: 'click',
hasChrome: false,
},
render: (args) => (
Expand Down
2 changes: 1 addition & 1 deletion code/ui/components/src/tooltip/WithTooltip.tsx
Expand Up @@ -139,7 +139,7 @@ const WithTooltipPure: FC<WithTooltipPureProps> = ({

WithTooltipPure.defaultProps = {
svg: false,
trigger: 'hover',
trigger: 'click',
closeOnOutsideClick: false,
placement: 'top',
modifiers: [
Expand Down
2 changes: 0 additions & 2 deletions code/ui/manager/src/components/sidebar/Menu.tsx
Expand Up @@ -107,7 +107,6 @@ export const SidebarMenu: FC<{
return (
<WithTooltip
placement="top"
trigger="click"
closeOnOutsideClick
tooltip={({ onHide }) => <SidebarMenuList onHide={onHide} menu={menu} />}
>
Expand All @@ -124,7 +123,6 @@ export const ToolbarMenu: FC<{
return (
<WithTooltip
placement="bottom"
trigger="click"
closeOnOutsideClick
modifiers={[
{
Expand Down
1 change: 0 additions & 1 deletion code/ui/manager/src/components/sidebar/RefBlocks.tsx
Expand Up @@ -169,7 +169,6 @@ export const ErrorBlock: FC<{ error: Error }> = ({ error }) => (
Oh no! Something went wrong loading this Storybook.
<br />
<WithTooltip
trigger="click"
tooltip={
<ErrorDisplay>
<ErrorFormatter error={error} />
Expand Down
2 changes: 0 additions & 2 deletions code/ui/manager/src/components/sidebar/RefIndicator.tsx
Expand Up @@ -190,7 +190,6 @@ export const RefIndicator = React.memo(
<IndicatorPlacement ref={forwardedRef}>
<WithTooltip
placement="bottom-start"
trigger="click"
tooltip={
<MessageWrapper>
<Spaced row={0}>
Expand Down Expand Up @@ -218,7 +217,6 @@ export const RefIndicator = React.memo(
{ref.versions && Object.keys(ref.versions).length ? (
<WithTooltip
placement="bottom-start"
trigger="click"
tooltip={
<TooltipLinkList
links={Object.entries(ref.versions).map(([id, href]) => ({
Expand Down
2 changes: 1 addition & 1 deletion code/ui/manager/src/containers/Menu.stories.tsx
Expand Up @@ -36,7 +36,7 @@ export default {
height: '300px',
}}
>
<WithTooltip placement="top" trigger="click" startOpen tooltip={storyFn()}>
<WithTooltip placement="top" startOpen tooltip={storyFn()}>
<div>Tooltip</div>
</WithTooltip>
</div>
Expand Down

0 comments on commit e6b9c0f

Please sign in to comment.