Ayushrawatcy009 commented on code in PR #77455: URL: https://github.com/apache/airflow/pull/77455#discussion_r4707518666
########## airflow-core/src/airflow/ui/src/components/AltClickExtraLinks.tsx: ########## @@ -0,0 +1,126 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { MouseEvent, ReactElement } from "react"; +import { useEffect, useRef, useState } from "react"; + +import { Box, Button, Portal, VStack } from "@chakra-ui/react"; +import { useNavigate, type To } from "react-router-dom"; + +import type { ExtraLink } from "src/hooks/useTaskInstanceExtraLinks"; + +type Props = { + readonly children: ReactElement; + readonly links: ReadonlyArray<ExtraLink>; + readonly navigateTo: To; + readonly replace?: boolean; +}; + +type MenuPosition = { + readonly x: number; + readonly y: number; +}; + +const ExtraLinksMenu = ({ + links, + onClose, + position, +}: { + readonly links: ReadonlyArray<ExtraLink>; + readonly onClose: () => void; + readonly position: MenuPosition; +}) => { + const firstItemRef = useRef<HTMLAnchorElement | null>(null); + + useEffect(() => { + firstItemRef.current?.focus(); + }, []); + + return ( + <Portal> + <Box data-testid="extra-links-backdrop" inset={0} onClick={onClose} position="fixed" zIndex="modal" /> + <Box Review Comment: fixed in commit `7ab988f3bc`. The comment is on the old Portal/backdrop implementation; `AltClickExtraLinks` now uses Chakra `Menu` (`Menu.Root`, `Menu.Trigger`, `Menu.Positioner`, `Menu.Content`, `Menu.Item`), so it gets arrow-key navigation, Escape/outside dismissal, and viewport-aware placement. It is still opened from Alt+click via a controlled `anchorPoint`, and tests now assert the menu roles and Escape behavior. Changes made: - Replaced hand-rolled Portal/backdrop menu with Chakra Menu. - Added controlled anchorPoint to keep open behavior tied to Alt+click. - Updated AltClickExtraLinks.test.tsx for role="menu", role="menuitem", hrefs, and Escape. - Commit `7ab988f3bc` has been pushed to PR #77455. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
