Try/menu appear animation tests#1
Open
adamsilverstein wants to merge 23 commits into
Open
Conversation
This PR aims to start work on WordPress#8029, by creating an animation for use with popovers, and by starting documentation for hwo to best use animation. It: - Adds a "scale and appear" animation to the block toolbar, the more menu, and the block library - It adds a very very early draft of an animation document, which includes an early inventory of current animations in use.
1241764 to
124f2c4
Compare
…erstein/gutenberg into try/menu-appear-animation-tests
4a2af7e to
c681247
Compare
adamsilverstein
pushed a commit
that referenced
this pull request
Apr 11, 2019
…rdPress#12312) * Improve typing performance by splitting attributes in state tree. Attributes have been moved to `attributesByClientId` in order to reduce the impact of typing throughout the state tree. See WordPress#11782. Review fixes pass #1 Simplify block flattening code in reducers. Remove alignment toolbar optimization; should be a different PR Fix minor bug in test Fix failing getBlockDependantsCacheBust test Remove new `*WithoutAttributes` selectors. We'll go with a different approach: use the existing selectors, but keep the dependencies as they are. The attributes may get stale, but it doesn't matter if they're not being used. Change attributesById structure to not have an inner attributes Simplifying some selector dependencies Simplify withSaveReusableBlock a bit further and clarify its existence Reuse constant instead of running omit again Remove no longer needed mapClientIds Simplifying reducers after review comments. Further changes to selectors after review Fix types in JSDoc Renaming attributesByClientId to attributes Further selector fixes after review * Revert changes to getBlocks dependants
adamsilverstein
pushed a commit
that referenced
this pull request
Jun 11, 2026
* Post Revisions: Upgrade `diff` from v4 to v8 Aligns `packages/editor` and `packages/block-editor` with `packages/sync` on `diff@^8.0.3` (needed for the Syncpack alignment work in WordPress#77950 / WordPress#77954). The bump exposes two unrelated upstream changes that would regress the post-revisions UI: 1. v6+ adds a "deletions before insertions" tie-breaker, so for inputs with multiple equal-length LCSes (whitespace-block pivots, paragraph swaps), `diffArrays` selects a different match than v4 did. The downstream `pairSimilarBlocks` step then mis-pairs blocks and shows two confusing inline diffs instead of a clean modified+unchanged pair. 2. v6+ stops treating whitespace as a token in `diffWords`, coalescing adjacent word changes into one removed/added pair and losing per-word precision in inline rich-text diffs. Fix on the consumer side so existing tests pass without touching any assertion: - Replace the imported `diffArrays` in `block-diff.js` with a local v4-compatible port of `Diff.prototype.diff` (Myers, array+strict-eq), including v4's `(added, removed)` -> `(removed, added)` swap in `buildValues` so condensed sections still render in the right order. - Switch `diffWords` -> `diffWordsWithSpace` for the inline rich-text diff, the `changedAttributes` panel diff, and the `Meta` field diff in `revision-fields-diff`. `preserve-client-ids.js` and `block-compare` (uses `diffChars`) need no changes -- neither hits the affected v6+ behaviours and their tests pass unmodified under v8. 41/41 revision-related unit tests pass; full `npm run test:unit` is green. Closes WordPress#77976 * Post Revisions: Drop vendored `diffArrays`, filter whitespace blocks Addresses review feedback on WordPress#77992 (findings 1, 5, 6, 7, 8, 9). The previous commit inlined ~150 LoC of v4's Myers algorithm to keep `diffArrays`'s LCS pivot stable across the v4 -> v8 bump. That preserved all existing test assertions but came at a real maintenance cost. The cleaner approach (the issue's original "Class 1" fix): just drop freeform/whitespace pseudo-blocks from both arrays before LCS. Without the `\n\n` blocks competing as a match anchor, v8's "deletions before insertions" tie-breaker picks the same content-block pivot v4 did for every input that was previously failing, and the inlined algorithm becomes unnecessary. Two follow-ups to make that approach work end-to-end: 1. Adjust `pairSimilarBlocks`'s placement heuristic. The original heuristic looked for *added* blocks between the removed and added positions to decide where to anchor a paired modification. With whitespace pseudo-blocks no longer in the result list, an unchanged content block between the two positions is now the only "the modified block crosses current-revision content" signal -- so the heuristic now also fires on unchanged blocks (but still ignores removed blocks, which don't exist in the current revision and so don't count as crossing). 2. Relax the `'handles two blocks that swapped positions'` assertion to the user-facing invariant (one unmarked + one removed/added pair with same content) rather than which side of the swap gets matched. For a pure swap the two LCS choices are equally valid -- both v4 and v8 produce semantically-correct output, they just disagree on which block reads as "unchanged" -- so asserting one is testing the implementation, not the behaviour. Net: -191 +56 LoC in `block-diff.js`. All 33 block-diff unit tests pass and the broader revision-related suites stay green. * Post Revisions: Migrate remaining `diff` imports, add CHANGELOG entries Addresses review feedback on WordPress#77992 (findings 2, 3, 4, 10). - `preserve-client-ids.js` and `block-compare/index.js` now import `diffArrays` / `diffChars` from the top-level `'diff'` package instead of the deep `'diff/lib/diff/<name>'` paths. v8's `package.json` `exports` map only wildcards `./lib/*.js` (with extension); the bare-folder `./lib/` mapping requires a trailing slash. The deep paths only resolve here because the bundler/Jest resolver fills in `.js` -- a future tooling change could break them. v8 also marks the package `sideEffects: false`, so the historical tree-shaking reason for the deep imports no longer applies. The "diff doesn't tree-shake correctly" comment in `block-compare/index.js` is now stale and gets removed. - Add `### Internal` entries to `packages/editor/CHANGELOG.md` and `packages/block-editor/CHANGELOG.md` recording the major dependency bump. * Post Revisions: Add focused tests + clarify comments for `diffRawBlocks` Addresses round-2 review feedback on WordPress#77992 (human #1, #3, #5, #6 + Codex test gaps a, b). - Add a `'filters whitespace-only freeform pseudo-blocks before LCS'` test that's a direct canary for the whitespace filter — without the filter, `pairSimilarBlocks` would mis-match two paragraphs across the whitespace pseudo-block as the LCS anchor and produce two confused modified blocks instead of one modified + one unchanged. - Add a `'places paired modification at current-revision position when only unchanged blocks sit between'` test exercising the new `crossesCurrentContent` "unchanged between removed and added" branch in isolation. Previously only hit transitively through the `'handles block move with a tiny change'` test, which mixes that branch with the whitespace-filter path and other heuristics. - Tighten the `crossesCurrentContent` comment so it matches what the code actually checks (unpaired-added + unchanged) and adds a one-line note that 'removed' / `pairedAdded` blocks aren't checked because they aren't in the current revision. - Match the `diffWordsWithSpace` rationale comment between `block-diff.js` and `revision-fields-diff/index.js` for grep-ability. - Document on `diffRawBlocks` that the whitespace filter is intentionally re-applied at every recursive level so the function stays self-contained when called directly with raw grammar output. No logic changes. All 35 block-diff tests + the broader unit suite (32598 tests) stay green. * Update package-lock.json * Post Revisions: Restore `toMatchObject` form of the swap test Addresses review feedback on WordPress#77992: the relaxed invariant-style assertion was harder to read than the surrounding tests. Revert to the single `toMatchObject([...])` form, with the parenthetical updated to reflect that v8's LCS tie-breaker now anchors on the second block (prev[1] -> curr[0]) instead of the first (prev[0] -> curr[1]). The rest of the comment is restored verbatim from trunk. For a pure swap the two LCS choices are equally valid, so a future `diff` major bump that flips the tie-breaker again would just require updating this snapshot — no UX regression. * Post Revisions: Round-3 review tweaks Addresses ellatrix's follow-up review comments on WordPress#77992: - `test/block-diff.js`: Convert the new `'places paired modification at current-revision position when only unchanged blocks sit between'` test to a single `toMatchObject([...])` snapshot, matching the surrounding tests in this file. Also tighten the swap-test comment: drop the speculative "future major bump" note and keep just a single line acknowledging that pre-v8 LCS picked the other block. - `block-diff.js`: Reassign the `currentRaw` / `previousRaw` parameters in place of introducing renamed `currentBlocks` / `previousBlocks` locals — the filtered entries are still raw grammar-parser output, just a subset, so dropping the "Raw" classifier was misleading. No-param-reassign is not enabled in the project's ESLint config. No logic changes. All 35 block-diff tests + the broader unit suite stay green. Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: aduth <aduth@git.wordpress.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
How has this been tested?
Screenshots
Types of changes
Checklist: