Skip to content

web/elements: rebuild ak-search-select as a form-associated element - #25610

Merged
GirlBossRush merged 14 commits into
mainfrom
web/search-select-self-render-selected
Oct 8, 2026
Merged

GirlBossRush merged 14 commits into
mainfrom
web/search-select-self-render-selected

Conversation

@GirlBossRush

@GirlBossRush GirlBossRush commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

This PR rebuilds ak-search-select as a single form-associated element The commits are grouped for review: the element, then components and shared sources, presets, call sites by area, and tests.

  • Search select now implements the ARIA native combobox input and a popover listbox, and positions itself with CSS anchor positioning.
  • In addition to ElementInternals support, the selection stays listed even when it isn't on the fetched page.
  • Added function components for common search select fields:
    • AKSearchSelect
    • AKSearchSelectField
    • AKFlowSearch
    • AKFlowField,
    • AKCertificateSearch
  • Also fixed a bug where LDAP and RADIUS preselecting the brand's flow primary key instead of the slug.

@GirlBossRush
GirlBossRush requested a review from a team as a code owner August 31, 2026 19:53
@netlify

netlify Bot commented Aug 31, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 171be88
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6a95db9fd1b6830008f6ef19
😎 Deploy Preview https://deploy-preview-25610--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 Aug 31, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 171be88
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a95db9ffbf1cd0008bac006
😎 Deploy Preview https://deploy-preview-25610--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.

@GirlBossRush GirlBossRush self-assigned this Aug 31, 2026
@GirlBossRush GirlBossRush added area:frontend Features or issues related to the browser, TypeScript, Node.js, etc backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8 labels Aug 31, 2026
@GirlBossRush GirlBossRush moved this from Todo to Needs review in authentik Core Aug 31, 2026
@codecov

codecov Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.36%. Comparing base (edee3e0) to head (def879d).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #25610   +/-   ##
=======================================
  Coverage   92.35%   92.36%           
=======================================
  Files        1177     1177           
  Lines       78074    78074           
  Branches     4129     4129           
=======================================
+ Hits        72107    72112    +5     
+ Misses       5901     5896    -5     
  Partials       66       66           
Flag Coverage Δ
conformance 32.81% <ø> (+0.04%) ⬆️
e2e 37.57% <ø> (+<0.01%) ⬆️
integration 29.63% <ø> (+<0.01%) ⬆️
rust 46.45% <ø> (ø)
unit 93.78% <ø> (+<0.01%) ⬆️
unit-migrate 93.77% <ø> (+<0.01%) ⬆️

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

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

@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-171be88e1672d70004ebad76d18c8b5d09854f3a
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-171be88e1672d70004ebad76d18c8b5d09854f3a

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

@GirlBossRush
GirlBossRush force-pushed the web/search-select-self-render-selected branch from 171be88 to 8ed1749 Compare August 31, 2026 21:10
@GirlBossRush GirlBossRush removed the backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8 label Sep 29, 2026
@GirlBossRush
GirlBossRush force-pushed the web/search-select-self-render-selected branch 2 times, most recently from e30f53b to 14dbf85 Compare September 29, 2026 15:19
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Playwright e2e

Download this run's HTML report and traces, then open the report:

gh run download 37723468869 -D playwright-artifacts
npx playwright show-report playwright-artifacts/playwright-report

Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-def879db6652fb5f1cd10b8bdb393492b9541c85
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-def879db6652fb5f1cd10b8bdb393492b9541c85

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

@GirlBossRush
GirlBossRush force-pushed the web/search-select-self-render-selected branch from 14dbf85 to c686978 Compare September 29, 2026 21:13
@GirlBossRush GirlBossRush changed the title web/elements: render selected value in ak-search-select regardless of page web: fix search-select values lost on submit; replace custom event mixins Sep 29, 2026
@GirlBossRush GirlBossRush changed the title web: fix search-select values lost on submit; replace custom event mixins web/elements: rebuild ak-search-select as a form-associated element Sep 30, 2026
@GirlBossRush
GirlBossRush force-pushed the web/search-select-self-render-selected branch from a055efe to 4fcb48c Compare September 30, 2026 01:08
@GirlBossRush
GirlBossRush changed the base branch from main to web/typed-events-listen September 30, 2026 01:08
@GirlBossRush
GirlBossRush removed this pull request from stack #26569 October 6, 2026 04:12
@GirlBossRush
GirlBossRush changed the base branch from web/typed-events-listen to main October 6, 2026 04:13
@GirlBossRush
GirlBossRush force-pushed the web/search-select-self-render-selected branch from 4fcb48c to d19f04b Compare October 6, 2026 04:14
@GirlBossRush
GirlBossRush added this pull request to stack #26727 October 6, 2026 04:22
@GirlBossRush
GirlBossRush requested a review from BeryJu October 6, 2026 16:20

@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.

Two things that stood out at me, but this is mostly too huge to review manually. (Sorry). I did my best, but this ate two hours and i'm still not sure of everything going on inside.

element.show();
await element.updateComplete;

element.renderRoot.querySelector<HTMLElement>("#option-blank")!.click();

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.

So if I have Flow or Certificate with the slug "blank", which one will I get? :-)

aki(CoreApi)
.coreUsersList(withQuery(query, { ordering: "username" }))
.then(({ results }) => results),
keyOf: (user) => String(user.pk),

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.

export interface User {
    /**
     *
     * @type {number}
     * @memberof User
     */
    readonly pk: number;

Is there any place in our code where this key is sent back through client-ts to the server? Because if there is, this is gonna break.

Some fields only know their value once they have loaded their options, e.g. a
search select that preselects a default flow. A form submitted before then
serialized them empty.

- Add a SettlingFormField contract (a `settled` promise) and
  settleFormFields(), which waits on every settling field in a form.
- Form.submit() settles the form's fields before validating and serializing.
- FormWizardPage no longer pre-validates before submit(), which settles and
  validates itself, and treats a `false` result as a failed step.
- The application wizard's provider step settles before checking validity.
Replace ak-search-select, its view, ak-list-select, and the EZ variant with a single
form-associated element built on the platform: a native combobox input, a popover
listbox positioned with CSS anchor positioning (with a JS fallback for Firefox), and
ElementInternals for its value and validity.

- `value` is the chosen key. Options come from a SearchSelectSource (fetchObjects,
  keyOf, labelOf, describe, isDisabled, groupBy, preselect). `selectedObject` labels
  the field before the options load, and the selection stays listed when it isn't on
  the fetched page.
- `settled` resolves once the latest fetch lands, for Form.submit() to wait on.
- Keyboard navigation with aria-activedescendant, a pinned action item, a blank
  option, creatable free text, and closing on outside clicks even when focus stays in
  the input. A late preselection doesn't close an open menu.
- The input takes its accessible name from `label`, the field's <label>, or the
  enclosing horizontal form element, since none can reach it across the shadow root.
- `emptyValue` sets what an empty field serializes as, for string fields.

Component tests cover the element.
Replace the per-type wrapper elements with function components over the new element:
AKSearchSelect and AKSearchSelectField, AKFlowSearch and AKFlowField, and
AKCertificateSearch. Shared sources for policies, groups, users, device access groups,
roles, and notification mappings live in #admin/common/search-sources.
ak-file-search-input moves onto a file source with free-text values.
The authorization, authentication, and invalidation flow fields repeat across the
provider forms, and the pre-authentication, authentication, and enrollment flow fields
across the source forms. So do the SAML NameID and AuthnContextClassRef mapping fields.
Each becomes a field preset with the shared wording, which forms can override.
Also fixes the brand's default flows never preselecting in the LDAP and RADIUS
provider forms: the brand stores slugs, not primary keys.
Brands, outposts, events, RBAC, blueprints, endpoints, lifecycle rules, requests,
tokens, users, object attributes, property mapping tests, and sync objects. Blueprint
paths serialize as an empty string when unset, since the field isn't nullable.
The form fixture finds search selects by their label and chooses options by role.
New cases cover a default flow still loading at submit, keyboard and search, outside
clicks, edit forms showing saved values, and a group binding in the application
wizard.
Rebasing onto main brought in settle-form-fields.ts from #26566, while this
branch still carried its own earlier copy of settleFormFields and
SettlingFormField in form-associated-element.ts. Form.ts imported both, which
failed type checking with a duplicate identifier.

Keeps main's version, which also times out and never rejects, and points
Form and ak-search-select at it.
@GirlBossRush
GirlBossRush force-pushed the web/search-select-self-render-selected branch from 38b5fed to d34f0b7 Compare October 8, 2026 00:15
…n tests

The LDAP source form submitted its parent group as `additionalParentGroup`,
a name the API doesn't know, so the group never saved. Submit it as
`syncParentGroup`.

The admin tables render a second create button in their empty state while rows
load, so an unscoped "New …" click could match two buttons. Scope those clicks
in the e2e tests to the table toolbar, as the provider tests already do.
…s unique

- Sources can declare parseKey(); the user and provider sources send their
  primary keys as numbers again, matching main.
- Object option IDs get their own prefix and an unambiguous encoding, so keys
  like "blank" or "action" no longer collide with the built-in options.
- The active option scrolls into view by its rendered ID.
Wizard steps and modal forms checked validity synchronously before waiting for
fields to settle, so a required search select still preselecting its default
rejected the click and never retried.

- WizardStep waits for settled() before validating Next/Finish and ignores
  repeat clicks meanwhile; ApplicationWizardStep settles its form.
- ModalForm settles the form before its validity check.
- Cover the provider step with an e2e test that holds back the invalidation flows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Features or issues related to the browser, TypeScript, Node.js, etc

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants