Feature: The program finder narrows its options in the browser
Description
The Course Finder now offers only the combinations that find a program. Once a visitor selects a degree, every topic no program of that degree carries is disabled, and it is enabled again as soon as the degree is cleared or changed. A category the editor preselected narrows the other selects as soon as the page has loaded. All of this happens in the browser, without a request and without reloading the page.
The submit button states how many programs the current selection finds, for example "Show 2 programs". A visually hidden status message announces a changed number to screen reader users, politely and without moving the focus. Loading the page announces nothing.
Without JavaScript the finder behaves as before: every option a program in the storage of the finder carries is selectable, the button shows its plain label, and submitting opens the program list with the selection applied.
With Include subcategories switched on in the finder, a program counts for every category above the ones it carries, so a parent the server offers stays selectable in the browser as well.
Impact
Every finder narrows its options after the update. The page with a finder loads
the new module
@fgtclb/ through the import
map of the extension, and the finder form carries the categories of the
programs of its storage in the attribute
data-. Narrowing disables options,
also on a site that hides options without results, where it is only the
options no program carries that are left out.
A project that overrides Program/ gets the narrowing only
when its template carries the data attributes the module reads, see
Narrowing the options in the browser. Without them the override keeps working as
before and nothing is narrowed. A project that reloads the finder on every
change, through a turbo frame for example, can drop that code.
The count is written into a new span inside the submit button. The button
reads the new labels finder. and
finder. of locallang., with %d for the number.