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

Menu trigger not opening menu #333

Open
t3chguy opened this issue Jan 7, 2025 · 3 comments
Open

Menu trigger not opening menu #333

t3chguy opened this issue Jan 7, 2025 · 3 comments
Labels
O-Occasional Affects or can be seen by some users regularly or most users rarely P-Web Platform Web S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect

Comments

@t3chguy
Copy link
Member

t3chguy commented Jan 7, 2025

Platform

  • Web

Package version

  • 7.6.1 (issue not present in 7.5.0)

Description

See test failures on element-hq/element-web#28708

Screen.Recording.2025-01-07.at.15.21.25.mov
@robintown
Copy link
Member

Taking a timeboxed look at this: you can reproduce this by putting a tooltip on any menu trigger.

@robintown
Copy link
Member

Testing with the following story:

import React, { ComponentPropsWithoutRef, forwardRef, Suspense, useState } from "react";
import { Meta, StoryObj } from "@storybook/react";
import UserProfileIcon from "@vector-im/compound-design-tokens/assets/web/icons/user-profile";

import { Menu as MenuComponent } from "./Menu";
import { MenuItem } from "./MenuItem";
import { Button } from "../Button/Button";
import { Tooltip } from "../Tooltip/Tooltip";
import { TooltipProvider } from "../Tooltip/TooltipProvider";

type Props = Omit<
  React.ComponentProps<typeof MenuComponent>,
  "open" | "onOpenChange" | "trigger" | "align" | "children"
>;

const TooltipButton = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof Button>>((props, ref) => {
  return (
    <Tooltip description='This is a tooltip'>
      <Button ref={ref} {...props}>
        Open menu
      </Button>
    </Tooltip>
  )
})

const Template: React.FC<Props> = (args) => {
  const [open, setOpen] = useState(true);

  return (
    <Suspense>
    <TooltipProvider>
    <MenuComponent
      {...args}
      open={open}
      onOpenChange={setOpen}
      trigger={<TooltipButton />}
      align="start"
    >
      <MenuItem Icon={UserProfileIcon} label="Profile" onSelect={() => {}} />
    </MenuComponent>
    </TooltipProvider>
  </Suspense>
  );
};

const meta = {
  title: "Menu2",
  component: Template,
  tags: ["autodocs"],
  argTypes: {},
  args: {},
} satisfies Meta<typeof Template>;
export default meta;

type Story = StoryObj<typeof meta>;

export const WithTooltip: Story = {
  args: { title: "Today's Menu" },
}
c0589107008a1bd13f7c06c665781815579939e5 is the first bad commit
commit c0589107008a1bd13f7c06c665781815579939e5
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue Dec 10 14:50:09 2024 +0000

    Update react monorepo to v19

 package.json |  8 ++++----
 yarn.lock    | 35 +++++++++++++++++++++++------------
 2 files changed, 27 insertions(+), 16 deletions(-)

@robintown
Copy link
Member

Setting this aside for now. Conclusion is that something seems to be wrong with Tooltip's handling of refs post-React-19 (but why is that affecting Element Web, which is on React 18?)

@robintown robintown removed their assignment Jan 28, 2025
@dbkr dbkr added S-Minor Impairs non-critical functionality or suitable workarounds exist O-Occasional Affects or can be seen by some users regularly or most users rarely labels Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-Occasional Affects or can be seen by some users regularly or most users rarely P-Web Platform Web S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect
Projects
None yet
Development

No branches or pull requests

3 participants