Skip to content

web/elements: add viewport helpers and extend intersection observer - #21508

Merged
GirlBossRush merged 1 commit into
mainfrom
web/viewport-helpers
Apr 10, 2026
Merged

GirlBossRush merged 1 commit into
mainfrom
web/viewport-helpers

Conversation

@GirlBossRush

@GirlBossRush GirlBossRush commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add elements/utils/viewport.ts with findNearestBoxTarget and isInViewport helpers for elements that render with display: contents
  • Extend the @intersectionObserver decorator with an opt-in useAncestorBox mode that walks the DOM to find a parent with an actual layout box, fixing false-negative visibility for display: contents hosts

Test plan

  • Existing @intersectionObserver() call sites (Tabs, Table, ak-timestamp, FlowExecutor, LibraryPage) continue to work — the new parameter defaults to false
  • Verify display: contents elements report correct intersection when useAncestorBox is enabled
    Split from web/a11y: Modal revisions, behavior fixes #21206 to ease review.

@GirlBossRush
GirlBossRush requested a review from a team as a code owner April 9, 2026 06:42
@codecov

codecov Bot commented Apr 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.26%. Comparing base (bb20350) to head (2cf8e93).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

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              
Flag Coverage Δ
conformance 37.03% <ø> (+<0.01%) ⬆️
e2e 42.95% <ø> (-0.01%) ⬇️
integration 33.96% <ø> (+<0.01%) ⬆️
rust 60.50% <ø> (ø)
unit 91.89% <ø> (ø)
unit-migrate 91.98% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@netlify

netlify Bot commented Apr 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 2cf8e93
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/69d91533e199500008bed8cb
😎 Deploy Preview https://deploy-preview-21508--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Apr 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 2cf8e93
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/69d915337708360008d071ef
😎 Deploy Preview https://deploy-preview-21508--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kensternberg-authentik kensternberg-authentik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@GirlBossRush
GirlBossRush force-pushed the web/viewport-helpers branch from 7da1b82 to 2cf8e93 Compare April 10, 2026 15:20
@GirlBossRush
GirlBossRush enabled auto-merge (squash) April 10, 2026 15:20
@GirlBossRush
GirlBossRush merged commit b590bff into main Apr 10, 2026
109 checks passed
@GirlBossRush
GirlBossRush deleted the web/viewport-helpers branch April 10, 2026 15:51
@github-actions

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

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)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

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-2cf8e93966b7b3e651b9da549501046271f4c4eb

Afterwards, run the upgrade commands from the latest release notes.

kensternberg-authentik added a commit that referenced this pull request Apr 11, 2026
* main:
  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)
kensternberg-authentik added a commit that referenced this pull request Apr 13, 2026
* 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)
davepgreene pushed a commit to davepgreene/authentik that referenced this pull request Apr 13, 2026
…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.
davepgreene pushed a commit to davepgreene/authentik that referenced this pull request Apr 13, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants