Skip to content

Commit a256e60

Browse files
committed
DataViews: Fix filter toggle flickering when there are locked or primary filters (#75913) (#76068)
Co-authored-by: Mamaduka <[email protected]> Co-authored-by: jameskoster <[email protected]> Co-authored-by: oandregal <[email protected]> Co-authored-by: SirLouen <[email protected]> Co-authored-by: t-hamano <[email protected]> Source: WordPress/gutenberg@e1d2ea7
1 parent 0179044 commit a256e60

29 files changed

Lines changed: 192 additions & 164 deletions

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ This is a duplicate of the [WordPress/Gutenberg](https://github.com/WordPress/gu
55
You are currently viewing the version build from the source:
66

77
* Branch: `wp/7.0`
8-
* Commit: [WordPress/Gutenberg@`d4e4afa00ac`](https://github.com/WordPress/gutenberg/commit/d4e4afa00aca6b403a14863f5084a444cffec19e), [Browse files](https://github.com/WordPress/gutenberg/tree/d4e4afa00aca6b403a14863f5084a444cffec19e)
8+
* Commit: [WordPress/Gutenberg@`e1d2ea74b04`](https://github.com/WordPress/gutenberg/commit/e1d2ea74b04e8bb87620a84379b833c564f03f37), [Browse files](https://github.com/WordPress/gutenberg/tree/e1d2ea74b04e8bb87620a84379b833c564f03f37)
99

1010
> [!NOTE]
1111
> This readme file has replaced the original version included in the upstream repository.
1212
>
13-
> The [original `README.md` file](https://github.com/WordPress/gutenberg/blob/d4e4afa00aca6b403a14863f5084a444cffec19e/README.md) file for this commit can be found in the upstream repository.
13+
> The [original `README.md` file](https://github.com/WordPress/gutenberg/blob/e1d2ea74b04e8bb87620a84379b833c564f03f37/README.md) file for this commit can be found in the upstream repository.
1414
1515
## Pupose
1616

build/modules/registry.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@
2222
'path' => 'latex-to-mathml/loader',
2323
'asset' => 'latex-to-mathml/loader.min.asset.php',
2424
),
25+
array(
26+
'id' => '@wordpress/vips/worker',
27+
'path' => 'vips/worker',
28+
'asset' => 'vips/worker.min.asset.php',
29+
),
30+
array(
31+
'id' => '@wordpress/vips/loader',
32+
'path' => 'vips/loader',
33+
'asset' => 'vips/loader.min.asset.php',
34+
),
35+
array(
36+
'id' => '@wordpress/a11y',
37+
'path' => 'a11y/index',
38+
'asset' => 'a11y/index.min.asset.php',
39+
),
2540
array(
2641
'id' => '@wordpress/interactivity-router',
2742
'path' => 'interactivity-router/index',
@@ -37,21 +52,6 @@
3752
'path' => 'abilities/index',
3853
'asset' => 'abilities/index.min.asset.php',
3954
),
40-
array(
41-
'id' => '@wordpress/a11y',
42-
'path' => 'a11y/index',
43-
'asset' => 'a11y/index.min.asset.php',
44-
),
45-
array(
46-
'id' => '@wordpress/vips/worker',
47-
'path' => 'vips/worker',
48-
'asset' => 'vips/worker.min.asset.php',
49-
),
50-
array(
51-
'id' => '@wordpress/vips/loader',
52-
'path' => 'vips/loader',
53-
'asset' => 'vips/loader.min.asset.php',
54-
),
5555
array(
5656
'id' => '@wordpress/core-abilities',
5757
'path' => 'core-abilities/index',

build/routes/navigation-list/content.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13047,11 +13047,10 @@ function FiltersToggle() {
1304713047
},
1304813048
[onChangeView, setIsShowingFilter]
1304913049
);
13050-
const visibleFilters = filters.filter((filter) => filter.isVisible);
13051-
const hasVisibleFilters = !!visibleFilters.length;
1305213050
if (filters.length === 0) {
1305313051
return null;
1305413052
}
13053+
const hasVisibleFilters = filters.some((filter) => filter.isVisible);
1305513054
const addFilterButtonProps = {
1305613055
label: (0, import_i18n27.__)("Add filter"),
1305713056
"aria-expanded": false,
@@ -13068,13 +13067,18 @@ function FiltersToggle() {
1306813067
setIsShowingFilter(!isShowingFilter);
1306913068
}
1307013069
};
13070+
const hasPrimaryOrLockedFilters = filters.some(
13071+
(filter) => filter.isPrimary || filter.isLocked
13072+
);
1307113073
const buttonComponent = /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
1307213074
import_components26.Button,
1307313075
{
1307413076
ref: buttonRef,
1307513077
className: "dataviews-filters__visibility-toggle",
1307613078
size: "compact",
1307713079
icon: funnel_default,
13080+
disabled: hasPrimaryOrLockedFilters,
13081+
accessibleWhenDisabled: true,
1307813082
...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
1307913083
}
1308013084
);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '41bed71e145442330a2a');
1+
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => 'a0c85e40286c555c8ac2');

build/routes/navigation-list/content.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/routes/pattern-list/content.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12958,11 +12958,10 @@ function FiltersToggle() {
1295812958
},
1295912959
[onChangeView, setIsShowingFilter]
1296012960
);
12961-
const visibleFilters = filters.filter((filter) => filter.isVisible);
12962-
const hasVisibleFilters = !!visibleFilters.length;
1296312961
if (filters.length === 0) {
1296412962
return null;
1296512963
}
12964+
const hasVisibleFilters = filters.some((filter) => filter.isVisible);
1296612965
const addFilterButtonProps = {
1296712966
label: (0, import_i18n27.__)("Add filter"),
1296812967
"aria-expanded": false,
@@ -12979,13 +12978,18 @@ function FiltersToggle() {
1297912978
setIsShowingFilter(!isShowingFilter);
1298012979
}
1298112980
};
12981+
const hasPrimaryOrLockedFilters = filters.some(
12982+
(filter) => filter.isPrimary || filter.isLocked
12983+
);
1298212984
const buttonComponent = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
1298312985
import_components24.Button,
1298412986
{
1298512987
ref: buttonRef,
1298612988
className: "dataviews-filters__visibility-toggle",
1298712989
size: "compact",
1298812990
icon: funnel_default,
12991+
disabled: hasPrimaryOrLockedFilters,
12992+
accessibleWhenDisabled: true,
1298912993
...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
1299012994
}
1299112995
);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-patterns', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/lazy-editor', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '7ddc510e23d192de5d06');
1+
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-patterns', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/lazy-editor', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => 'fe1e130ea4030b5bc5df');

build/routes/pattern-list/content.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/routes/post-list/content.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12937,11 +12937,10 @@ function FiltersToggle() {
1293712937
},
1293812938
[onChangeView, setIsShowingFilter]
1293912939
);
12940-
const visibleFilters = filters.filter((filter) => filter.isVisible);
12941-
const hasVisibleFilters = !!visibleFilters.length;
1294212940
if (filters.length === 0) {
1294312941
return null;
1294412942
}
12943+
const hasVisibleFilters = filters.some((filter) => filter.isVisible);
1294512944
const addFilterButtonProps = {
1294612945
label: (0, import_i18n27.__)("Add filter"),
1294712946
"aria-expanded": false,
@@ -12958,13 +12957,18 @@ function FiltersToggle() {
1295812957
setIsShowingFilter(!isShowingFilter);
1295912958
}
1296012959
};
12960+
const hasPrimaryOrLockedFilters = filters.some(
12961+
(filter) => filter.isPrimary || filter.isLocked
12962+
);
1296112963
const buttonComponent = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
1296212964
import_components24.Button,
1296312965
{
1296412966
ref: buttonRef,
1296512967
className: "dataviews-filters__visibility-toggle",
1296612968
size: "compact",
1296712969
icon: funnel_default,
12970+
disabled: hasPrimaryOrLockedFilters,
12971+
accessibleWhenDisabled: true,
1296812972
...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
1296912973
}
1297012974
);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => 'b9b562906f206a8f3c03');
1+
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => 'ed085b811a3dfd39d1b1');

0 commit comments

Comments
 (0)