Skip to content

Commit

Permalink
Forward ExternalLink component ref
Browse files Browse the repository at this point in the history
This is necessary for upcoming changes in appkit, that
will allow users to navigate header menus using arrow
keys.
  • Loading branch information
owi92 committed Nov 16, 2023
1 parent ff56034 commit 1b5cbb1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions frontend/src/relay/auth.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react";
import { fetchQuery, graphql } from "react-relay";
import { bug, match } from "@opencast/appkit";

Expand Down Expand Up @@ -41,13 +42,13 @@ export type ExternalLinkProps = PropsWithChildren<{
* The redirection then takes you to the final destination.
* If the setting is not enabled, this is just a normal link.
*/
export const ExternalLink: React.FC<ExternalLinkProps> = ({
export const ExternalLink = React.forwardRef<HTMLButtonElement, ExternalLinkProps>(({
className,
fallback,
service,
children,
params,
}) => {
}, ref) => {
const target = serviceUrl(service);
for (const [key, value] of Object.entries(params)) {
target.searchParams.append(key, value);
Expand Down Expand Up @@ -78,14 +79,14 @@ export const ExternalLink: React.FC<ExternalLinkProps> = ({
<input type="hidden" name="jwt" />

<button
className={className}
{...{ ref, className }}
css={{
backgroundColor: "transparent",
border: "none",
}}
>{children}</button>
</form>;
};
});

/**
* Internal helper function to fetch JWTs mainly to hide the ceremony involved
Expand Down

0 comments on commit 1b5cbb1

Please sign in to comment.