fix: don't rely on requestAnimationFrame (#34065)
This commit is contained in:
parent
c9ae644e5f
commit
443b2a2bbc
|
|
@ -143,7 +143,7 @@ export function useIsAnchored(id: AnchorID) {
|
|||
export function Anchor({ id, children }: React.PropsWithChildren<{ id: AnchorID }>) {
|
||||
const ref = React.useRef<HTMLDivElement>(null);
|
||||
const onAnchorReveal = React.useCallback(() => {
|
||||
requestAnimationFrame(() => ref.current?.scrollIntoView({ block: 'start', inline: 'start' }));
|
||||
ref.current?.scrollIntoView({ block: 'start', inline: 'start' });
|
||||
}, []);
|
||||
useAnchor(id, onAnchorReveal);
|
||||
|
||||
|
|
|
|||
|
|
@ -936,6 +936,9 @@ for (const useIntermediateMergeReport of [true, false] as const) {
|
|||
await expect(attachment).not.toBeInViewport();
|
||||
await page.getByLabel('attach "foo-2"').getByTitle('link to attachment').click();
|
||||
await expect(attachment).toBeInViewport();
|
||||
|
||||
await page.reload();
|
||||
await expect(attachment).toBeInViewport();
|
||||
});
|
||||
|
||||
test('should highlight textual diff', async ({ runInlineTest, showReport, page }) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue