Repository navigation
web/elements: add viewport helpers and extend intersection observer - #21508
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21508 +/- ##
==========================================
- Coverage 92.27% 92.26% -0.01%
==========================================
Files 1032 1032
Lines 59658 59658
Branches 2537 2537
==========================================
- Hits 55047 55046 -1
- Misses 4546 4547 +1
Partials 65 65
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
kensternberg-authentik
left a comment
There was a problem hiding this comment.
Minor question, but I assume the answer is yes, they're equivalent. Approved!
| @@ -0,0 +1,22 @@ | |||
| export function findNearestBoxTarget(element?: Element | null): Element { | |||
| if (!element) { | |||
There was a problem hiding this comment.
Is this different from or equivalent to element === document.documentElement?
…ction observer Some lazy-loaded elements render with `display: contents` so they don't produce a layout box of their own, which makes `IntersectionObserver` report them as never visible. Add `useAncestorBox` to the `intersectionObserver` decorator: when set (or when the element sets `displayBox="contents"`), fall back to the nearest ancestor that actually has a layout box and test that against the viewport. Extract the lookups into a new `elements/utils/viewport.ts` with `findNearestBoxTarget` and `isInViewport` helpers that can be reused outside the decorator.
7da1b82 to
2cf8e93
Compare
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-2cf8e93966b7b3e651b9da549501046271f4c4eb
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-2cf8e93966b7b3e651b9da549501046271f4c4ebAfterwards, run the upgrade commands from the latest release notes. |
* main: web: build system had some legacy stuff that I found confusing while working on the CSS ordering (#20698) core: bump ruff from 0.15.9 to 0.15.10 (#21559) core: bump types-jwcrypto from 1.5.0.20260408 to 1.5.7.20260409 (#21561) core: bump lxml from 6.0.3 to 6.0.4 (#21560) ci: bump peter-evans/create-pull-request from 8.1.0 to 8.1.1 (#21566) ci: bump docker/build-push-action from 7.0.0 to 7.1.0 (#21563) ci: bump actions/upload-artifact from 7.0.0 to 7.0.1 (#21565) core: bump library/golang from `da39430` to `c0074c7` in /lifecycle/container (#21567) ci: bump taiki-e/install-action from 2.75.1 to 2.75.5 in /.github/actions/setup (#21569) web: bump mermaid from 11.13.0 to 11.14.0 in /web (#21527) core, web: update translations (#21552) web: bump basic-ftp from 5.2.1 to 5.2.2 in /web (#21543) web: User Wizard, Modal Revisions Merge Branch (#21336) web/elements: default @listen target to host element and add split-button Dropdown (#21512) ci: parallel tests (#21515) website/docs: add another sentence to First Steps about restricting access to apps (#21517) web/elements: add scrollbar helpers and apply to Interface (#21511) web/elements: add viewport helpers and extend intersection observer (#21508)
…oauthentik#21508) web/elements: add viewport helpers and opt-in ancestor-box to intersection observer Some lazy-loaded elements render with `display: contents` so they don't produce a layout box of their own, which makes `IntersectionObserver` report them as never visible. Add `useAncestorBox` to the `intersectionObserver` decorator: when set (or when the element sets `displayBox="contents"`), fall back to the nearest ancestor that actually has a layout box and test that against the viewport. Extract the lookups into a new `elements/utils/viewport.ts` with `findNearestBoxTarget` and `isInViewport` helpers that can be reused outside the decorator.
…oauthentik#21508) web/elements: add viewport helpers and opt-in ancestor-box to intersection observer Some lazy-loaded elements render with `display: contents` so they don't produce a layout box of their own, which makes `IntersectionObserver` report them as never visible. Add `useAncestorBox` to the `intersectionObserver` decorator: when set (or when the element sets `displayBox="contents"`), fall back to the nearest ancestor that actually has a layout box and test that against the viewport. Extract the lookups into a new `elements/utils/viewport.ts` with `findNearestBoxTarget` and `isInViewport` helpers that can be reused outside the decorator.
Summary
elements/utils/viewport.tswithfindNearestBoxTargetandisInViewporthelpers for elements that render withdisplay: contents@intersectionObserverdecorator with an opt-inuseAncestorBoxmode that walks the DOM to find a parent with an actual layout box, fixing false-negative visibility fordisplay: contentshostsTest plan
@intersectionObserver()call sites (Tabs, Table, ak-timestamp, FlowExecutor, LibraryPage) continue to work — the new parameter defaults tofalsedisplay: contentselements report correct intersection whenuseAncestorBoxis enabledSplit from web/a11y: Modal revisions, behavior fixes #21206 to ease review.