Tabs with invalid input are not focused

Created on 12 July 2017, over 7 years ago
Updated 9 September 2024, 2 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

Postponed: needs info

Version

4.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

Merge Requests

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 11 months ago
  • πŸ‡ͺπŸ‡ΈSpain rcodina Barcelona

    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.

  • πŸ‡¦πŸ‡ΊAustralia Nadim Hossain

    Re-rolled the patch 23 against the new release 8.x-3.6

  • πŸ‡ΊπŸ‡¦Ukraine kuflievskiy

    Re-rolled the patch 26 against the new release(3.6), branch 8.x-3.x.
    Works on Drupal 10.3.0 with Gin admin theme.

  • πŸ‡ΊπŸ‡ΈUnited States rjg

    #33 is working for me on Drupal core 10.3.2 an#33 is working for me on Drupal core 10.3.2 and field_group 3.6.0 with horizontal tabs.d field_group 3.6.0

  • First commit to issue fork.
  • Status changed to Needs review 3 months ago
  • πŸ‡ͺπŸ‡ΈSpain juandels3 Seville

    Patch #33 working for Drupal 10.3 with version 8.x-3.6 module. I have created the merge request and it is ready for review.

  • Pipeline finished with Failed
    3 months ago
    Total: 276s
    #250283
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Please use MR's!

  • Status changed to Postponed: needs info 2 months ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Please check if this issue still exists in 4.x after πŸ› Ensure visibility of invalid fields (JS) RTBC has been merged now.

  • πŸ‡ͺπŸ‡ΈSpain juandels3 Seville

    Hi.
    I confirm that this bug is not reproduced in version 4.x-dev, so it is already fixed from this version onwards. Thanks!

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Thanks @juandels3 so let's close this closed as duplicate! :)

  • I use the patch from the MR !71 on the version 3.6, but I found an issue with the submit button being targeted with not enough specificity.
    I have an entity browser button on one of my tabs, and as soon as I click it, it goes back to my first tab.
    The selector in the patch is not specific enough :
    $(context).find('input.form-submit')

    The entity browser also has the form-submit class, and a click on this button triggers the check for invalid fields.

    This selector could be more appropriated :
    $(context).find('input.form-submit.button--primary')

    Or :
    $(context).find('input.form-submit').not('.entity-browser-processed')

    I'm not sure if this applies to the 4.x-dev version, as it seems to be treated in a different way.

Production build 0.71.5 2024