Skip to content

Commit

Permalink
fix(bcd): observe header, not full table
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Oct 28, 2024
1 parent 473ff5d commit 1d36f8d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type BCD from "@mdn/browser-compat-data/types";
import { BrowserName } from "./browser-info";
import { forwardRef } from "react";

function PlatformHeaders({
platforms,
Expand Down Expand Up @@ -63,17 +64,16 @@ export function browserToIconName(browser: string) {
return browserStart === "firefox" ? "simple-firefox" : browserStart;
}

export function Headers({
platforms,
browsers,
browserInfo,
}: {
platforms: string[];
browsers: BCD.BrowserName[];
browserInfo: BCD.Browsers;
}) {
export const Headers = forwardRef<
HTMLTableSectionElement,
{
platforms: string[];
browsers: BCD.BrowserName[];
browserInfo: BCD.Browsers;
}
>(function Headers({ platforms, browsers, browserInfo }, ref) {
return (
<thead>
<thead ref={ref}>
<PlatformHeaders
platforms={platforms}
browsers={browsers}
Expand All @@ -82,4 +82,4 @@ export function Headers({
<BrowserHeaders browsers={browsers} />
</thead>
);
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,12 @@ export default function BrowserCompatibilityTable({
</a>
<figure className="table-container">
<figure className="table-container-inner">
<table
key="bc-table"
className="bc-table bc-table-web"
ref={observedNode}
>
<table key="bc-table" className="bc-table bc-table-web">
<Headers
platforms={platforms}
browsers={browsers}
browserInfo={browserInfo}
ref={observedNode}
/>
<tbody>
<FeatureListAccordion
Expand Down

0 comments on commit 1d36f8d

Please sign in to comment.