sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Select2 autocomplete's results don't get focus after clicking on input field #8078

Closed tonyaxo closed 1 year ago

tonyaxo commented 1 year ago

Environment

Sonata packages

show

``` $ composer show --latest 'sonata-project/*' sonata-project/admin-bundle 4.25.0 4.25.0 The missing Symfony Admin Generator sonata-project/doctrine-orm-admin-bundle 4.9.1 4.13.0 Integrate Doctrine ORM into the SonataAdminBundle Transitive dependencies not required in composer.json: sonata-project/block-bundle 4.20.0 4.21.0 Symfony SonataBlockBundle sonata-project/cache 2.2.0 2.2.0 Cache library Package sonata-project/cache is abandoned, you should avoid using it. No replacement was suggested. sonata-project/doctrine-extensions 1.18.1 2.3.0 Doctrine2 behavioral extensions sonata-project/exporter 2.14.0 3.1.1 Lightweight Exporter library sonata-project/form-extensions 1.18.1 1.19.1 Symfony form extensions sonata-project/twig-extensions 1.12.0 2.1.0 Sonata twig extensions ```

Symfony packages

show

``` $ composer show --latest 'symfony/*' symfony/asset v5.4.21 v6.3.0 Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScr... symfony/browser-kit v5.4.21 v6.3.0 Simulates the behavior of a web browser, allowing you to make requests, click on lin... symfony/cache v5.4.23 v6.3.0 Provides extended PSR-6, PSR-16 (and tags) implementations symfony/console v5.4.21 v6.3.0 Eases the creation of beautiful and testable command line interfaces symfony/css-selector v5.4.21 v6.3.0 Converts CSS selectors to XPath expressions symfony/debug-bundle v5.4.21 v6.3.0 Provides a tight integration of the Symfony VarDumper component and the ServerLogCom... symfony/dotenv v5.4.21 v6.3.0 Registers environment variables from a .env file symfony/flex v2.2.5 v2.3.1 Composer plugin for Symfony symfony/form v5.4.21 v6.3.0 Allows to easily create, process and reuse HTML forms symfony/framework-bundle v5.4.22 v6.3.0 Provides a tight integration between Symfony components and the Symfony full-stack f... symfony/intl v5.4.21 v6.3.0 Provides a PHP replacement layer for the C intl extension that includes additional d... symfony/lock v5.4.21 v6.3.0 Creates and manages locks, a mechanism to provide exclusive access to a shared resource symfony/lokalise-translation-provider v5.4.21 v6.3.0 Symfony Lokalise Translation Provider Bridge symfony/mailer v5.4.21 v6.3.0 Helps sending emails symfony/maker-bundle v1.48.0 v1.49.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and ... symfony/mime v5.4.23 v6.3.0 Allows manipulating MIME messages symfony/monolog-bundle v3.8.0 v3.8.0 Symfony MonologBundle symfony/phpunit-bridge v6.2.7 v6.3.0 Provides utilities for PHPUnit, especially user deprecation notices management symfony/property-info v5.4.23 v6.3.0 Extracts information about PHP class' properties using metadata of popular sources symfony/proxy-manager-bridge v5.4.21 v6.3.0 Provides integration for ProxyManager with various Symfony components symfony/runtime v5.4.21 v6.3.0 Enables decoupling PHP applications from global state symfony/security-bundle v5.4.22 v6.3.0 Provides a tight integration of the Security component into the Symfony full-stack f... symfony/serializer v5.4.21 v6.3.0 Handles serializing and deserializing data structures, including object graphs, into... symfony/translation v5.4.21 v6.3.0 Provides tools to internationalize your application symfony/twig-bundle v5.4.21 v6.3.0 Provides a tight integration of Twig into the Symfony full-stack framework symfony/validator v5.4.21 v6.3.0 Provides tools to validate values symfony/web-profiler-bundle v5.4.21 v6.3.0 Provides a development tool that gives detailed information about the execution of a... symfony/workflow v5.4.21 v6.3.0 Provides tools for managing a workflow or finite state machine symfony/yaml v5.4.21 v6.3.0 Loads and dumps YAML files Transitive dependencies not required in composer.json: symfony/cache-contracts v2.5.2 v3.3.0 Generic abstractions related to caching symfony/config v5.4.21 v6.3.0 Helps you find, load, combine, autofill and validate configuration values of any kind symfony/dependency-injection v5.4.23 v6.3.0 Allows you to standardize and centralize the way objects are constructed in your app... symfony/deprecation-contracts v3.2.1 v3.3.0 A generic function and convention to trigger deprecation notices symfony/doctrine-bridge v5.4.21 v6.3.0 Provides integration for Doctrine with various Symfony components symfony/dom-crawler v5.4.21 v6.3.0 Eases DOM navigation for HTML and XML documents symfony/error-handler v5.4.23 v6.3.0 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher v5.4.22 v6.3.0 Provides tools that allow your application components to communicate with each other... symfony/event-dispatcher-contracts v2.5.2 v3.3.0 Generic abstractions related to dispatching event symfony/expression-language v5.4.21 v6.3.0 Provides an engine that can compile and evaluate expressions symfony/filesystem v5.4.23 v6.3.0 Provides basic utilities for the filesystem symfony/finder v5.4.21 v6.3.0 Finds files and directories via an intuitive fluent interface symfony/http-client v5.4.21 v6.3.0 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/http-client-contracts v2.5.2 v3.3.0 Generic abstractions related to HTTP clients symfony/http-foundation v5.4.23 v6.3.0 Defines an object-oriented layer for the HTTP specification symfony/http-kernel v5.4.23 v6.3.0 Provides a structured process for converting a Request into a Response symfony/monolog-bridge v5.4.21 v6.3.0 Provides integration for Monolog with various Symfony components symfony/options-resolver v5.4.21 v6.3.0 Provides an improved replacement for the array_replace PHP function symfony/password-hasher v5.4.21 v6.3.0 Provides password hashing utilities symfony/process v5.4.21 v6.3.0 Executes commands in sub-processes symfony/property-access v5.4.22 v6.3.0 Provides functions to read and write from/to an object or array using a simple strin... symfony/routing v5.4.22 v6.3.0 Maps an HTTP request to a set of configuration variables symfony/security-acl v3.3.2 v3.3.2 Symfony Security Component - ACL (Access Control List) symfony/security-core v5.4.22 v6.3.0 Symfony Security Component - Core Library symfony/security-csrf v5.4.21 v6.3.0 Symfony Security Component - CSRF Library symfony/security-guard v5.4.22 v5.4.22 Symfony Security Component - Guard symfony/security-http v5.4.23 v6.3.0 Symfony Security Component - HTTP Integration symfony/service-contracts v2.5.2 v3.3.0 Generic abstractions related to writing services symfony/stopwatch v5.4.21 v6.3.0 Provides a way to profile code symfony/string v5.4.22 v6.3.0 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points a... symfony/translation-contracts v2.5.2 v3.3.0 Generic abstractions related to translation symfony/twig-bridge v5.4.22 v6.3.0 Provides integration for Twig with various Symfony components symfony/var-dumper v5.4.23 v6.3.0 Provides mechanisms for walking through any arbitrary PHP variable symfony/var-exporter v6.2.10 v6.3.0 Allows exporting any serializable PHP data structure to plain PHP code ```

PHP version

$ php -v
PHP 8.1.18 (cli) (built: Apr 14 2023 19:12:08) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.18, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.18, Copyright (c), by Zend Technologies
    with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans

Subject

I've got this issue after update from: sonata-project/admin-bundle 4.2.2 sonata-project/doctrine-orm-admin-bundle 4.2.1

I solved this problem as described here

Minimal repository with the bug

Steps to reproduce

  1. Add filter with autocompletion for data griid
  2. Click on the edit field

Expected results

Shown dropdown field has focus

Actual results

Shown dropdown field doesn't has focus

VincentLanglet commented 1 year ago

From 4.2.2 to 4.25 ? That's a pretty huge bump. Would it be possible for you to look for the version which introduce the "regression" ? This could help for the fix.

tonyaxo commented 1 year ago

@VincentLanglet sonata-project/admin-bundle 4.14.0 sonata-project/doctrine-orm-admin-bundle 4.3.3

VincentLanglet commented 1 year ago

If 4.14.0 introduced the regression, it's related to https://github.com/sonata-project/SonataAdminBundle/compare/4.13.0...4.14.0. The relation is not obvious to me...

Any idea @jordisala1991 ?

tonyaxo commented 1 year ago

@VincentLanglet I'm not sure that 4.14 introduced the regress, something between 4.2.2-4.14

VincentLanglet commented 1 year ago

The issue should be the 4.12.0 version then I found the issue https://github.com/select2/select2/issues/5993 and in 4.12.0 we bumped jQuery https://github.com/sonata-project/SonataAdminBundle/pull/7824

I seems fix in Jquery 3.7.0 so we should bump the version again, do you want to try ?

tonyaxo commented 1 year ago

@VincentLanglet upgrading to 3.7 solves this issue but why is there linter error? Shall I fix it?

VincentLanglet commented 1 year ago

@VincentLanglet upgrading to 3.7 solves this issue but why is there linter error? Shall I fix it?

I fixed it in https://github.com/sonata-project/SonataAdminBundle/pull/8080 ; rebasing should solve the issue.