Skip to content

Commit

Permalink
Navigation block: check that the modal is set before using contains (
Browse files Browse the repository at this point in the history
…#51962)

* Start with package.json and README

* Add new package to docs/manifest.json

* Copy-paste runtime files from block-library

* Add .npmrc file

* Add interactivity package to dependencies

* Create a custom webpack config for interactivity

* Expose interactivity runtime in `wp.interactivity`

* Update package-lock

* Add `@wordpress/interactivity` to block-library deps

* Rename entry point to index

* Remove vendors chunk

* Add oddly required aliases

* Add view prefix to interactivity.js files

* Use view-interactivity files when enabled

* Stop adding defer to Interactivity scripts

* Remove webpack config for interactivity.js files

* Remove interactivity runtime from block-library

* Remove interactivity runtime from sideEffects

* Undo temporary fix for Interactivity API in dependency-extraction-webpack-plugin

* Remove script loader for Interactivity API runtime

* Remove block-librar/interactivity from build_files

* Add src/index.js to Interactivity API entry file

* Remove unnecessary aliases

* Restore data-wp-body directive

* Interactivity API: add `wp_store` (#51191)

* Add `wp_store` to the Interactivity API

* Rename WP_Interactivity_Store and move filter to scripts file

* Remove todos to change the store id

* Rename syntax to -- and data-wp-interactive (#51241)

* Interactivity API: initial support for SSR (#51229)

* Initial version working with basic support for wp-bind

* Add wp-context

* Add wp-class

* Add wp-style

* Add wp-text

* Add directive processing tests

* Add WP_Directive_Processor class tests

* Add wp-bind tests

* Add wp-context tests

* Add wp-class tests

* Add wp-style tests

* Add wp-text tests

* Add evaluate tests

* Fix PHP lint

* Prevent errors with incorrect JSON objects

* Add support for functions in the server

* Remove require for missing script-loader.php

* Remove missing PHP file

* Rename view file and fix block.json

* Add "interactivity" to supports and fix renaming

* Code improvements for the SSR part of the Interactivity API (#51640)

* Fix multi-line comments and add examples

* Add parse_attribute_name static method to WP_Directive_Processor

* Replace array functions with a foreach loop

* Add explanatory comment for the negation operator check

* Replace $array with $path_segments

* Minor fix for the negation operator comment

* Call only instances of Closure

* Improve negation operator code style

* Do not lower-case tags

* Use static parse_attribute_name inside directive processors

* Add basic error handling in wp-context

* Fix hidden identation errors

* Use the correct variable name

* Fix test for evaluating functions

* Remove references to "attribute" directives

* Remove emtpy lines in multi-line function calls

* Fix typo

---------

Co-authored-by: Luis Herranz <luisherranz@gmail.com>

* Add the full Interactivity API runtime (but removing the client-side navigation). (#51194)

* Add show and text directives

* Move directive bind tests

* Move the rest of e2e tests (except csn-related)

* Add interactive-blocks plugin for e2e tests

* Move test plugins one folder up

* Add plugin to .wp-env.json

* Change directive-bind spec file to use new plugin

* Move plugin to e2e-tests package

* Move HTML for directive-bind to plugin

* Update exposed properties from preact

* Refactor directive-bind spec file

* Create directive-effect block for e2e testing

* Update directive-effect spec file

* Remove unnecessary files

* Fix e2e tests for bind and effect directives

* Refactor fixtures and use them for bind and effect

* Remove unnecessary editorScript

* Fix e2e test for directive priorities

* Remove unnecessary files

* Fix negation operator

* Refactor store-tag e2e tests

* Refactor directive-class e2e tests

* Remove extra spaces

* Add util for removing all created posts

* Add block for context directive

* Add block for directive show testing

* Remove unintentionally added artifact

* Ignore artifacts generated inside /test/e2e

* Remove unused html

* Add block for directive text testing

* Add blocks for tovdom testing

* Update directives syntax in e2e tests

* Add getLink to InteractivityUtils

* Fix php lint errors

* Add disable_directives_ssr param

* Fix phpcs errors

* Fix missing phpcs error and warnings

* Remove `wp-interactivity` from `viewScript`

---------

Co-authored-by: Luis Herranz <luisherranz@gmail.com>

* Check that modal exists before using `contains`

---------

Co-authored-by: David Arenas <david.arenas@automattic.com>
  • Loading branch information
luisherranz and DAreRodz authored Jun 30, 2023
1 parent 5d2fd62 commit dec307c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/block-library/src/navigation/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const closeMenu = ( { context, selectors }, menuClosedOn ) => {
// Check if the menu is still open or not.
if ( ! selectors.core.navigation.isMenuOpen( { context } ) ) {
if (
context.core.navigation.modal.contains(
context.core.navigation.modal?.contains(
window.document.activeElement
)
) {
Expand Down Expand Up @@ -155,7 +155,7 @@ store( {
// `window.document.activeElement` doesn't change
if (
context.core.navigation.isMenuOpen.click &&
! context.core.navigation.modal.contains(
! context.core.navigation.modal?.contains(
event.relatedTarget
) &&
event.target !== window.document.activeElement
Expand Down

0 comments on commit dec307c

Please sign in to comment.