Tabs with invalid input are not focused

Created on 12 July 2017, almost 7 years ago
Updated 25 March 2024, 3 months ago

When a tab contains a field that the browser invalidates before submission, the tab containing that field should be focused so it's not a mystery as to why the form can't be submitted. The attached patch should check on form submit if inputs are valid, and if not set the focused tab.

πŸ› Bug report
Status

Needs work

Version

3.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States blake.thompson

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡«πŸ‡·France opi

    Thanks @Antoniya for your more generic patch #26, works like a charm !

  • Status changed to Needs work 6 months ago
  • πŸ‡ͺπŸ‡ΈSpain rcodina

    The patch on #26 breaks tests.

  • πŸ‡ΊπŸ‡¦Ukraine kuflievskiy

    @rcodina I have also noticed the issue in the tests/src/Functional/MigrateUiFieldGroupTest.php file while executing the tests.
    The error I saw is this one:

    1) Drupal\Tests\field_group_migrate\Functional\MigrateUiFieldGroupTest::testFieldGroupMigrate
    Undefined array key "Drupal\sqlite\Driver\Database\sqlite"

    /var/www/html/web/modules/contrib/field_group/contrib/field_group_migrate/tests/src/Functional/MigrateUiFieldGroupTest.php:135
    /var/www/html/web/modules/contrib/field_group/contrib/field_group_migrate/tests/src/Functional/MigrateUiFieldGroupTest.php:157
    /var/www/html/web/modules/contrib/field_group/contrib/field_group_migrate/tests/src/Functional/MigrateUiFieldGroupTest.php:59
    /var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

    But it seems to be not related to the fix and issue. I have just added

    $class_name = substr(strrchr($driver, '\\'), 1);
    $form = $drivers[$class_name]->getFormOptions($connection_options);
    

    Instead of at line 135 in field_group/contrib/field_group_migrate/tests/src/Functional/MigrateUiFieldGroupTest.php
    :

    $form = $drivers[$driver]->getFormOptions($connection_options);
    

    @rcodina Could you please specify the error you see in the tests? Or could probably someone else test it also?

    The patch on #26 works well for me.

Production build 0.69.0 2024