0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 05:02:57 +01:00
wagtail/client
Sage Abdullah a3cb4a6903 Fix filters from being removed when searching
Tippy unmounts its popper element from the DOM on hide, which means that
the filter fields get detached from the form. As a result, when
performing a search (which means the filters popup is closed), any
filters that have been applied will be lost. The issue does not occur
the other way around (filtering after search) because the filter fields
will still be in the DOM (as the popup is open while you're applying the
filters).

Unfortunately, Tippy does not offer a built-in option to keep the popper
mounted in the DOM when it's hidden.

As a workaround, use Tippy's hooks to re-append the popper to the DOM.
- onCreate: ensure the popper element is mounted even when the tippy was
  just created (normally it's only mounted when shown). This is useful
  to keep the filters when searching after a full-page refresh (e.g.
  after navigating to the next page in pagination).
- onHidden: ensure the popper is still mounted, to solve the main issue
- onShow: remove the hidden attribute and let tippy move the popper
  element as necessary (though usually this isn't necessary, because we
  remount it in the same position (the controller's element).

The 'hidden' attribute shouldn't cause any issues here as Tippy doesn't
use it. Without it, the solution still works because Tippy uses CSS to
make the element invisible. However, the complete CSS doesn't get
applied until the tippy is shown at least once. This means on initial
load with the onCreate hook, the tippy will take up the space while
being invisible. Using the attribute fixes it (and display:none probably
would too).

This behaviour can be enabled using the newly-added DropdownController
value 'keepMounted'.
2024-01-26 17:16:51 +00:00
..
scss Implement active filter button to open drilldown for specific filter 2024-01-24 09:43:42 +00:00
src Fix filters from being removed when searching 2024-01-26 17:16:51 +00:00
storybook Remove Safari 14 support in Wagtail admin – update browserslist and TypeScript (#11258) 2023-12-12 10:54:41 +00:00
tests Add unit tests & small fixes to OrderableController 2024-01-20 10:05:21 +10:00
extract-translatable-strings.js Ignore test files from extract-translatable-strings 2022-11-07 19:51:13 +10:00
package-lock.json Feature/field comment frontend (#6530) 2021-04-20 18:25:30 +01:00
README.md auto-format core markdown files (#8603) 2022-06-01 23:08:56 +10:00
tailwind.config.js Set the color-scheme property based on Wagtail theming support. Fix #11309 2024-01-22 16:04:05 +00:00
webpack.config.js Remove webpack rule for .woff 2023-11-09 08:57:56 +00:00

Wagtail client-side components

This library aims to give developers the ability to subclass and configure Wagtail's UI components.

Usage

npm install wagtail
import { Explorer } from 'wagtail';
// [...]
<Explorer />;

Development

# From the project root, start the webpack + styles compilation.
npm run start

You will also need:

Releases

The front-end is bundled at the same time as the Wagtail project. This package also aims to be available separately on npm as wagtail.