Replace `FilterSelectWidget` jQuery with Stimulus `RulesController` uplift
[!NOTE]
This PR builds on a previous refactor only PR https://github.com/wagtail/wagtail/pull/13379
This PR completes the third internal admin usage of conditional fields by adding the ability to be used for our FilteredSelect widget, closing https://github.com/wagtail/wagtail/issues/11045 . After this we can start on https://github.com/wagtail/wagtail/issues/2172 if there's a desire to support this 'officially'.
Testing
- Ensure you have some test data that supports 2-3 workflow different workflow types and then workflow tasks that match to a sub-set of those different types.
- Navigate to the workflow task report page.
- In the filter menu option, first check that all tasks are selectable by default.
- Now change the workflow filter to have a one that should limit the tasks.
- Observe that the task options should be limited.
- Select a task type that's only available in one workflow type.
- Now, go back to the workflow options and select a different workflow type.
- Observe, the task selection should have been cleared and reset back to default. I.e. it should not keep 'invalid' (filtered) selected values.
Screenshots
When no filtering is active
| Workflow select | Task (filtered) select |
|---|---|
When filtering is active
| Workflow select | Task (filtered) select |
|---|---|
Changed behaviour to current on Safari
Safari will not honour hidden attributes on option elements, instead we will use hidden & disabled - see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/hidden#browser_compatibility
This is a simpler approach, the jQuery approach had to keep a record of the DOM element and re-add it each time. This is error prone and harder to support.
Note that the 'disabled' options are visible but will not be selectable, when/if Safari align with all other browsers and the HTML standard, this will just work as per other browsers in the future.
| Safari (before) | Safari (after) |
|---|---|
Once 7.2 goes out, I'll have to rebase & fix conflicts on this one.
OK - rebased after the 7.2 release & after some changes/rework of https://github.com/wagtail/wagtail/pull/13379